Class CustomStampAppearanceStreamGenerator
-
- All Implemented Interfaces:
-
com.pspdfkit.annotations.appearance.AppearanceStreamGenerator
public class CustomStampAppearanceStreamGenerator implements AppearanceStreamGenerator
Collection of AppearanceStreamGenerator that can be registered via addAppearanceStreamGenerator to generate appearance streams for stamps with custom subjects.
-
-
Constructor Summary
Constructors Constructor Description CustomStampAppearanceStreamGenerator()
-
Method Summary
Modifier and Type Method Description void
addAppearanceStreamGenerator(@NonNull() String subject, @NonNull() AppearanceStreamGenerator appearanceStreamGenerator)
Adds new appearance stream generator for stamp annotations with given subject
.void
removeAppearanceStreamGenerator(@NonNull() String subject)
Removes appearance stream generator for the given subject
that was previously registered via addAppearanceStreamGenerator.DataProvider
getDataProviderForAnnotation(@NonNull() Annotation annotation, @NonNull() EnumSet<AppearanceStreamGenerator.AppearanceStreamGenerationOptions> options)
Called when the appearance stream data for the given annotation is needed. boolean
shouldUseGeneratorForAnnotation(@NonNull() Annotation annotation)
Asks the generator whether it should be used to generate the appearance stream for annotation
.-
-
Method Detail
-
addAppearanceStreamGenerator
void addAppearanceStreamGenerator(@NonNull() String subject, @NonNull() AppearanceStreamGenerator appearanceStreamGenerator)
Adds new appearance stream generator for stamp annotations with given
subject
. This overrides previously registered appearance stream generator for thesubject
.- Parameters:
subject
- Subject of annotations that will useappearanceStreamGenerator
to generate their AP stream.appearanceStreamGenerator
- Appearance stream generator for the specifiedsubject
.
-
removeAppearanceStreamGenerator
void removeAppearanceStreamGenerator(@NonNull() String subject)
Removes appearance stream generator for the given
subject
that was previously registered via addAppearanceStreamGenerator.- Parameters:
subject
- Previously registered subject.
-
getDataProviderForAnnotation
@Nullable() DataProvider getDataProviderForAnnotation(@NonNull() Annotation annotation, @NonNull() EnumSet<AppearanceStreamGenerator.AppearanceStreamGenerationOptions> options)
Called when the appearance stream data for the given annotation is needed.
The data represented by the DataProvider must be a validly formed PDF. The contents of the first page of that PDF file will be embedded in the
annotation
as its appearance stream.- Parameters:
annotation
- Annotation for which the AP stream is being generated.options
- Enum set of AP stream generation options.- Returns:
DataProvider representing a validly formed PDF or
null
to use annotation's default AP stream.
-
shouldUseGeneratorForAnnotation
boolean shouldUseGeneratorForAnnotation(@NonNull() Annotation annotation)
Asks the generator whether it should be used to generate the appearance stream for
annotation
.- Parameters:
annotation
- Annotation for which the AP stream is being generated.
-
-
-
-