Class PageRenderConfiguration.Builder
-
- All Implemented Interfaces:
public class PageRenderConfiguration.Builder
Builder to create a PageRenderConfiguration instance
-
-
Constructor Summary
Constructors Constructor Description PageRenderConfiguration.Builder()
-
Method Summary
Modifier and Type Method Description PageRenderConfiguration.Builder
paperColor(@ColorInt() int color)
Background paper color for contents. PageRenderConfiguration.Builder
formHighlightColor(@ColorInt() int color)
Sets color used for highlighting editable form fields. PageRenderConfiguration.Builder
formItemHighlightColor(@ColorInt() int color)
Sets color used for highlighting selected items inside lists, combo boxes and similar. PageRenderConfiguration.Builder
formRequiredFieldBorderColor(@ColorInt() int color)
Sets color of the border around required form fields. PageRenderConfiguration.Builder
signHereOverlayBackgroundColor(@ColorInt() @Nullable() Integer color)
Sets color of the background of the sign here arrow. PageRenderConfiguration.Builder
invertColors(boolean invertColors)
Sets if the colors will be inverted in the document. PageRenderConfiguration.Builder
toGrayscale(boolean toGrayscale)
Sets if the colors will be converted to grayscale. PageRenderConfiguration.Builder
redactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotation preview enabled, false
by default.PageRenderConfiguration.Builder
cache(boolean useCache)
Use PSPDFKits disk and memory cache to render subsequent bitmaps faster. PageRenderConfiguration.Builder
reuseBitmap(@Nullable() Bitmap bitmap)
Reuse bitmap as the rendering target and prevent allocation of new one. PageRenderConfiguration.Builder
region(int x, int y, int fullPageWidth, int fullPageHeight)
Render a sub-region of the page. PageRenderConfiguration.Builder
renderedDrawables(@NonNull() List<PdfDrawable> pdfDrawables)
PageRenderConfiguration.Builder
showSignHereOverlay(boolean showOverlay)
Sets whether or not the sign here overlay in signature form fields should be shown. PageRenderConfiguration.Builder
excludedAnnotations(List<Integer> excludedAnnotations)
Sets the list of annotations (by object numbers) to be excluded from rendering. PageRenderConfiguration.Builder
excludedAnnotationTypes(List<AnnotationType> excludedAnnotationTypes)
Sets the list of annotations (by type) to be excluded from rendering. PageRenderConfiguration
build()
Creates the configuration for page rendering. -
-
Method Detail
-
paperColor
@NonNull() PageRenderConfiguration.Builder paperColor(@ColorInt() int color)
Background paper color for contents. White by default.
- Parameters:
color
- ARGB color integer.
-
formHighlightColor
@NonNull() PageRenderConfiguration.Builder formHighlightColor(@ColorInt() int color)
Sets color used for highlighting editable form fields. Each editable form field is overlaid with rectangle filled with this color.
- Parameters:
color
- ARGB color integer (can beColor#TRANSPARENT
).
-
formItemHighlightColor
@NonNull() PageRenderConfiguration.Builder formItemHighlightColor(@ColorInt() int color)
Sets color used for highlighting selected items inside lists, combo boxes and similar.
- Parameters:
color
- ARGB color integer (can beColor#TRANSPARENT
).
-
formRequiredFieldBorderColor
@NonNull() PageRenderConfiguration.Builder formRequiredFieldBorderColor(@ColorInt() int color)
Sets color of the border around required form fields.
- Parameters:
color
- ARGB color integer orColor#TRANSPARENT
to not show the border.
-
signHereOverlayBackgroundColor
@NonNull() PageRenderConfiguration.Builder signHereOverlayBackgroundColor(@ColorInt() @Nullable() Integer color)
Sets color of the background of the sign here arrow.
- Parameters:
color
- ARGB color integer orColor#TRANSPARENT
to not show the background.
-
invertColors
@NonNull() PageRenderConfiguration.Builder invertColors(boolean invertColors)
Sets if the colors will be inverted in the document.
- Parameters:
invertColors
-true
to invert colors,false
otherwise.
-
toGrayscale
@NonNull() PageRenderConfiguration.Builder toGrayscale(boolean toGrayscale)
Sets if the colors will be converted to grayscale.
- Parameters:
toGrayscale
-true
to covert to grayscale,false
otherwise.
-
redactionAnnotationPreviewEnabled
@NonNull() PageRenderConfiguration.Builder redactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotation preview enabled,
false
by default.- Parameters:
enable
-true
to enable redaction annotation preview.
-
cache
@NonNull() PageRenderConfiguration.Builder cache(boolean useCache)
Use PSPDFKits disk and memory cache to render subsequent bitmaps faster. True by default.
- Parameters:
useCache
-true
to use cache, false otherwise.
-
reuseBitmap
@NonNull() PageRenderConfiguration.Builder reuseBitmap(@Nullable() Bitmap bitmap)
Reuse bitmap as the rendering target and prevent allocation of new one. Note that there is no guarantee the bitmap will actually be reused when using cache. Bitmap must be the same size as the size passed in the rendering method.
- Parameters:
bitmap
- Bitmap to be reused.
-
region
@NonNull() PageRenderConfiguration.Builder region(int x, int y, int fullPageWidth, int fullPageHeight)
Render a sub-region of the page. Region clip rect is determined from the passed full page size parameters and the bitmap size (passed to renderPageToBitmap .
The meaning of the `x/y` parameters may be confusing at first but given the following information they might make more sense: Think of a coordinate system where (x,y,fullPageWidth,fullPageHeight) represents the whole page and (0,0,bitmapBuffer.width,bitmapBuffer.height) the part you want to render.
Example: Let's say in your coordinate system the page is placed at (px,py,pw,ph) and you want to render the (rx,ry,rw,rh) part of it and the coordinates are in pixels, then: - Allocate a `bitmapBuffer` with the size (rw,rh) - Set `region()` with `x/y/fullPageWidth/Height` = (px-rx,py-ry,pw,ph) - Use a Bitmap of size (rx,ry) Note: It's normal for `X/Y` to become negative and for `fullPageWidth/Height` to be greater than `bitmap`.size in some situations.
For the `fullPageWidth` `fullPageHeight` params use correct ratio to w/h for the page and take into account how much you want to zoom. eg. For a page 600x800px zoomed in at 2x, you would set 1200x1600.
- Parameters:
x
- x-offset of the rendered region, can be negative.y
- y-offset of the rendered region, can be negative.fullPageWidth
- Width of the fully sized page including any scaling (see description above).fullPageHeight
- Height of the fully sized page.
-
renderedDrawables
@NonNull() PageRenderConfiguration.Builder renderedDrawables(@NonNull() List<PdfDrawable> pdfDrawables)
-
showSignHereOverlay
@NonNull() PageRenderConfiguration.Builder showSignHereOverlay(boolean showOverlay)
Sets whether or not the sign here overlay in signature form fields should be shown.
true
by default.- Parameters:
showOverlay
-true
to show the sign here overlay,false
to hide it.
-
excludedAnnotations
@NonNull() PageRenderConfiguration.Builder excludedAnnotations(List<Integer> excludedAnnotations)
Sets the list of annotations (by object numbers) to be excluded from rendering.
-
excludedAnnotationTypes
@NonNull() PageRenderConfiguration.Builder excludedAnnotationTypes(List<AnnotationType> excludedAnnotationTypes)
Sets the list of annotations (by type) to be excluded from rendering.
-
build
PageRenderConfiguration build()
Creates the configuration for page rendering.
-
-
-
-