Interface PdfDocument
-
- All Implemented Interfaces:
public interface PdfDocument
A PDF document. To create an instance use openDocument or related static methods on the PdfDocumentLoader class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interface
PdfDocument.PageRotation
Indicates that the returned value is a page rotation.
-
Method Summary
Modifier and Type Method Description abstract String
getUid()
This is the unique identifier for this document. abstract DocumentSource
getDocumentSource()
Returns source of this document. abstract PdfVersion
getPdfVersion()
Returns current PDF version of the document. abstract List<DocumentSource>
getDocumentSources()
Returns list of DocumentSources from which this document is loaded. abstract boolean
isWritableAndCanSave()
Query whether the document data source is read/write (is not compounded and comes from a supported source) and whether saving is enabled. abstract int
getPageCount()
Returns number of pages in this document. abstract Integer
getPageIndexForPageLabel(@NonNull() String pageLabel, boolean partialMatching)
Gets the page index for the given page label. abstract String
getPageLabel(@IntRange(from = 0) int pageIndex, boolean substituteWithPlainLabel)
Gets the page label. abstract DocumentPdfMetadata
getPdfMetadata()
Returns metadata (title, author, creation date, ...) of this document, stored in the PDF document dictionary. abstract DocumentXmpMetadata
getXmpMetadata()
Returns document metadata stored in the XMP metadata entries included in the PDF file. abstract EnumSet<DocumentPermissions>
getPermissions()
Returns set of currently applied permission flags on this document. abstract boolean
hasPermission(@NonNull() DocumentPermissions permission)
Test document permission flags. abstract String
getPageText(@IntRange(from = 0) int pageIndex)
Returns text content of the document page. abstract String
getPageText(@IntRange(from = 0) int pageIndex, int start, int length)
Returns text content between two character indexes. abstract String
getPageText(@IntRange(from = 0) int pageIndex, @NonNull() RectF rectF)
Returns text content inside given page rectangle. abstract int
getPageTextLength(@IntRange(from = 0) int pageIndex)
Gets number of characters in text on the page. abstract AnnotationProvider
getAnnotationProvider()
Returns AnnotationProvider object which handles annotations contained in this document. abstract BookmarkProvider
getBookmarkProvider()
Returns BookmarkProvider object which handles bookmarks contained in this document. abstract FormProvider
getFormProvider()
Returns FormProvider object which handles forms contained in this document. abstract EmbeddedFilesProvider
getEmbeddedFilesProvider()
Returns EmbeddedFilesProvider object which handles embedded files contained in this document. abstract List<OutlineElement>
getOutline()
Returns list of top-level (outline / table-of-contents) bookmarks. abstract Single<List<OutlineElement>>
getOutlineAsync()
Returns list of top-level (outline / table-of-contents) bookmarks, asynchronously. abstract boolean
hasOutline()
Checks whether this document has outline / table of contents abstract List<RectF>
getPageTextRects(@IntRange(from = 0) int pageIndex, int startIndex, int length)
Returns the rects of the range of characters on a page. abstract List<RectF>
getPageTextRects(@IntRange(from = 0) int pageIndex, int startIndex, int length, boolean markupPadding)
Returns the rects of the range of characters on a page. abstract int
getCharIndexAt(@IntRange(from = 0) int pageIndex, float x, float y)
Return the index of the closest character whose rect intersects the given x
andy
coordinates.abstract Size
getPageSize(@IntRange(from = 0) int pageIndex)
Returns a page size in PDF points. abstract int
getPageRotation(@IntRange(from = 0) int pageIndex)
Returns a page rotation in degrees. abstract int
getRotationOffset(@IntRange(from = 0) int pageIndex)
Returns the rotation offset applied to this page in degrees. abstract RectF
getPageBox(@IntRange(from = 0) int pageIndex, @NonNull() PdfBox box)
Returns rectangle describing one of the PDF page boxes. abstract Bitmap
renderPageToBitmap(@NonNull() Context context, int pageIndex, int width, int height)
Renders page to a bitmap. abstract Bitmap
renderPageToBitmap(@NonNull() Context context, int pageIndex, int width, int height, @NonNull() PageRenderConfiguration configuration)
Renders page to a bitmap. abstract Single<Bitmap>
renderPageToBitmapAsync(@NonNull() Context context, int pageIndex, int width, int height)
Renders page to a bitmap. abstract Single<Bitmap>
renderPageToBitmapAsync(@NonNull() Context context, @IntRange(from = 0) int pageIndex, int width, int height, @NonNull() PageRenderConfiguration configuration)
Renders page to a bitmap. abstract void
save(@NonNull() String path)
Saves the document to an external file even if it hasn't been changed. abstract void
save(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file even if it hasn't been changed. abstract boolean
saveIfModified()
Saves the document to original location if it has been changed. abstract boolean
saveIfModified(@NonNull() DocumentSaveOptions saveOptions)
Saves the document to original location if it has been changed. abstract boolean
saveIfModified(@NonNull() String path)
Saves the document to passed location if it has been changed. abstract boolean
saveIfModified(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to passed location if it has been changed. abstract Completable
saveAsync(@NonNull() String path)
Saves the document to an external file even if it hasn't been changed. abstract Completable
saveAsync(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file even if it hasn't been changed. abstract Single<Boolean>
saveIfModifiedAsync()
Saves the document back to original location if it has been changed. abstract Single<Boolean>
saveIfModifiedAsync(@NonNull() DocumentSaveOptions saveOptions)
Saves the document back to original location if it has been changed. abstract Single<Boolean>
saveIfModifiedAsync(@NonNull() String path)
Saves the document to an external file if it has been changed. abstract Single<Boolean>
saveIfModifiedAsync(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file if it has been changed. abstract boolean
wasModified()
Returns true
if this document was modified and should be saved to retain changes.abstract DocumentSaveOptions
getDefaultDocumentSaveOptions()
Returns a default set of document save options which have same permissions, password and PDF version set as this document. abstract String
getTitle()
Returns a document title. abstract DocumentSignatureInfo
getDocumentSignatureInfo()
Returns information about digital signatures in this document. abstract Single<DocumentSignatureInfo>
getDocumentSignatureInfoAsync()
Returns information about digital signatures in this document. abstract PdfDocumentCheckpointer
getCheckpointer()
Returns PdfDocumentCheckpointer object which handles the checkpoint for the document. abstract void
initPageCache()
Pre-fetches rotations, sizes and labels for all pages on a background thread. abstract Completable
initPageCacheAsync()
Pre-fetches rotations, sizes and labels for all pages on a background thread. abstract void
invalidateCache()
Invalidates the rendered cache of all the pages for this document
.abstract void
invalidateCacheForPage(@IntRange(from = 0) int pageIndex)
Invalidates the rendered cache of the given pageIndex
for thisdocument
.abstract boolean
isAutomaticLinkGenerationEnabled()
Whether or not automatic link generation is enabled. abstract void
setAutomaticLinkGenerationEnabled(boolean enabled)
Enables or disables automatic link generation. abstract void
setWatermarkTextFilteringEnabled(boolean enabled)
Enables or disables filtering of watermark text in text retrieval methods. abstract boolean
isWatermarkFilteringEnabled()
Whether or not watermark filtering is enabled. abstract PdfProjection
getPdfProjection()
Returns auxiliary projection class for mapping coordinate space between raw and normalized Pdf. abstract void
setRotationOffset(int pageRotation, @IntRange(from = 0) int pageIndex)
Applies a temporary rotation to the specified page of this document. abstract void
setRotationOffsets(@NonNull() SparseIntArray pageRotations)
Applies a temporary rotation to the specified pages of this document. abstract JavaScriptProvider
getJavaScriptProvider()
Returns JavaScriptProvider object which handles JavaScript execution for this document. abstract PageBinding
getPageBinding()
Returns the current document's PageBinding. abstract void
setPageBinding(@NonNull() PageBinding pageBinding)
Sets the PageBinding controlling in which direction pages of documents are laid out. abstract Array<byte>
getHashForDocumentRange(@NonNull() List<Long> range, @NonNull() HashAlgorithm hashAlgorithm)
Returns the hash of a particular byte range of the document. abstract Array<byte>
getHashForDocumentRange(int sourceIndex, @NonNull() List<Long> range, @NonNull() HashAlgorithm hashAlgorithm)
Returns the hash of a particular byte range of the document. abstract SecondaryMeasurementUnit
getSecondaryMeasurementUnit()
Gets the secondary unit value from the document abstract void
setSecondaryMeasurementUnit(@NonNull() SecondaryMeasurementUnit secondaryMeasurementUnit)
Sets the secondary unit value on the document. -
-
Method Detail
-
getUid
@NonNull() abstract String getUid()
This is the unique identifier for this document. It will be created automatically based on the content sources.
-
getDocumentSource
@NonNull() abstract DocumentSource getDocumentSource()
Returns source of this document.
-
getPdfVersion
@NonNull() abstract PdfVersion getPdfVersion()
Returns current PDF version of the document.
-
getDocumentSources
@NonNull() abstract List<DocumentSource> getDocumentSources()
Returns list of DocumentSources from which this document is loaded. A source can be either a file URI or a com.pspdfkit.document.providers.DataProvider. Only compound documents will have multiple sources.
-
isWritableAndCanSave
abstract boolean isWritableAndCanSave()
Query whether the document data source is read/write (is not compounded and comes from a supported source) and whether saving is enabled.
-
getPageCount
abstract int getPageCount()
Returns number of pages in this document.
-
getPageIndexForPageLabel
@Nullable() abstract Integer getPageIndexForPageLabel(@NonNull() String pageLabel, boolean partialMatching)
Gets the page index for the given page label.
- Parameters:
pageLabel
- The page label to search for.partialMatching
- If false, the exact string will be searched for.
-
getPageLabel
abstract String getPageLabel(@IntRange(from = 0) int pageIndex, boolean substituteWithPlainLabel)
Gets the page label.
- Parameters:
pageIndex
- The index of the page.substituteWithPlainLabel
- If true, and no page label exists for the given page, returns a string with the page number.
-
getPdfMetadata
@NonNull() abstract DocumentPdfMetadata getPdfMetadata()
Returns metadata (title, author, creation date, ...) of this document, stored in the PDF document dictionary.
-
getXmpMetadata
@NonNull() abstract DocumentXmpMetadata getXmpMetadata()
Returns document metadata stored in the XMP metadata entries included in the PDF file.
-
getPermissions
@NonNull() abstract EnumSet<DocumentPermissions> getPermissions()
Returns set of currently applied permission flags on this document.
-
hasPermission
abstract boolean hasPermission(@NonNull() DocumentPermissions permission)
Test document permission flags.
-
getPageText
@NonNull() abstract String getPageText(@IntRange(from = 0) int pageIndex)
Returns text content of the document page.
- Parameters:
pageIndex
- 0-indexed page number.
-
getPageText
@NonNull() abstract String getPageText(@IntRange(from = 0) int pageIndex, int start, int length)
Returns text content between two character indexes. Use getPageTextLength to determine the number of characters on page.
- Parameters:
pageIndex
- 0-indexed page number.start
- Index of first character in the range.length
- Length of the range.
-
getPageText
@NonNull() abstract String getPageText(@IntRange(from = 0) int pageIndex, @NonNull() RectF rectF)
Returns text content inside given page rectangle.
- Parameters:
pageIndex
- 0-indexed page number.rectF
- Page rectangle in the PDF coordinates.
-
getPageTextLength
abstract int getPageTextLength(@IntRange(from = 0) int pageIndex)
Gets number of characters in text on the page.
- Parameters:
pageIndex
- 0-indexed page number.
-
getAnnotationProvider
@NonNull() abstract AnnotationProvider getAnnotationProvider()
Returns AnnotationProvider object which handles annotations contained in this document.
-
getBookmarkProvider
@NonNull() abstract BookmarkProvider getBookmarkProvider()
Returns BookmarkProvider object which handles bookmarks contained in this document.
-
getFormProvider
@NonNull() abstract FormProvider getFormProvider()
Returns FormProvider object which handles forms contained in this document.
-
getEmbeddedFilesProvider
@NonNull() abstract EmbeddedFilesProvider getEmbeddedFilesProvider()
Returns EmbeddedFilesProvider object which handles embedded files contained in this document.
-
getOutline
@NonNull() abstract List<OutlineElement> getOutline()
Returns list of top-level (outline / table-of-contents) bookmarks. Bookmarks are organized in a tree-like structure and can have children. Note that this may take a while and should not be called on the main thread. If you want a quick check for whether document has outline, use hasOutline.
Note: When this document is a compound document, calling this method will only ever return the outline of the first document source.
-
getOutlineAsync
@NonNull() abstract Single<List<OutlineElement>> getOutlineAsync()
Returns list of top-level (outline / table-of-contents) bookmarks, asynchronously. Bookmarks are organized in a tree-like structure and can have children.
Note: When this document is a compound document, calling this method will only ever return the outline of the first document source.
-
hasOutline
abstract boolean hasOutline()
Checks whether this document has outline / table of contents
-
getPageTextRects
@NonNull() abstract List<RectF> getPageTextRects(@IntRange(from = 0) int pageIndex, int startIndex, int length)
Returns the rects of the range of characters on a page.
- Parameters:
pageIndex
- Page number of the page, zero indexed.startIndex
- Index of the starting character.length
- Number of characters in sequence.
-
getPageTextRects
@NonNull() abstract List<RectF> getPageTextRects(@IntRange(from = 0) int pageIndex, int startIndex, int length, boolean markupPadding)
Returns the rects of the range of characters on a page.
- Parameters:
pageIndex
- Page number of the page, zero indexed.startIndex
- Index of the starting character.length
- Number of characters in sequence.markupPadding
- Take the font height into account in the rects to make better suited for being displayed around the text.
-
getCharIndexAt
abstract int getCharIndexAt(@IntRange(from = 0) int pageIndex, float x, float y)
Return the index of the closest character whose rect intersects the given
x
andy
coordinates.- Parameters:
pageIndex
- Page number of the page, zero indexed.x
- X coordinate in PDF point units (usually 1/72 of an inch).y
- Y coordinate in PDF point units (usually 1/72 of an inch).
-
getPageSize
@NonNull() abstract Size getPageSize(@IntRange(from = 0) int pageIndex)
Returns a page size in PDF points.
- Parameters:
pageIndex
- Page number of the page to render, zero indexed.
-
getPageRotation
abstract int getPageRotation(@IntRange(from = 0) int pageIndex)
Returns a page rotation in degrees.
- Parameters:
pageIndex
- Page index of the requested page, zero indexed.
-
getRotationOffset
abstract int getRotationOffset(@IntRange(from = 0) int pageIndex)
Returns the rotation offset applied to this page in degrees.
- Parameters:
pageIndex
- Page index of the requested page, zero indexed.
-
getPageBox
abstract RectF getPageBox(@IntRange(from = 0) int pageIndex, @NonNull() PdfBox box)
Returns rectangle describing one of the PDF page boxes. If the page box dimension is not present in the PDF document, it's considered to be as large as the actual page size from getPageSize.
- Parameters:
pageIndex
- Page number of the page to render, zero indexed.box
- Box to retrieve for the page, from PdfBox.
-
renderPageToBitmap
@NonNull() abstract Bitmap renderPageToBitmap(@NonNull() Context context, int pageIndex, int width, int height)
Renders page to a bitmap.
- Parameters:
context
- Application context.pageIndex
- Page number of the page to render, zero indexed.width
- Bitmap width.height
- Bitmap height.
-
renderPageToBitmap
@NonNull() abstract Bitmap renderPageToBitmap(@NonNull() Context context, int pageIndex, int width, int height, @NonNull() PageRenderConfiguration configuration)
Renders page to a bitmap.
- Parameters:
context
- Application context.pageIndex
- Page number of the page to render, zero indexed.width
- Bitmap width.height
- Bitmap height.configuration
- Advanced configuration options.
-
renderPageToBitmapAsync
@NonNull() abstract Single<Bitmap> renderPageToBitmapAsync(@NonNull() Context context, int pageIndex, int width, int height)
Renders page to a bitmap.
- Parameters:
context
- Application context.pageIndex
- Page number of the page to render, zero indexed.width
- Bitmap width.height
- Bitmap height.
-
renderPageToBitmapAsync
@NonNull() abstract Single<Bitmap> renderPageToBitmapAsync(@NonNull() Context context, @IntRange(from = 0) int pageIndex, int width, int height, @NonNull() PageRenderConfiguration configuration)
Renders page to a bitmap.
- Parameters:
context
- Application context.pageIndex
- Page number of the page to render, zero indexed.width
- Bitmap width.height
- Bitmap height.configuration
- Advanced configuration options.
-
save
abstract void save(@NonNull() String path)
Saves the document to an external file even if it hasn't been changed. Note that this may take a while and should not be called on the main thread. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to the output document file.
-
save
abstract void save(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file even if it hasn't been changed. Note that this may take a while and should not be called on the main thread. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to the output document file.saveOptions
- Save options for the document, may benull
to use default set.
-
saveIfModified
abstract boolean saveIfModified()
Saves the document to original location if it has been changed. If there were no changes to the document, the document file will not be modified. Note that this may take a while and should not be called on the main thread.
-
saveIfModified
abstract boolean saveIfModified(@NonNull() DocumentSaveOptions saveOptions)
Saves the document to original location if it has been changed. If there were no changes to the document, the document file will not be modified. Note that this may take a while and should not be called on the main thread.
- Parameters:
saveOptions
- Save options for the document.
-
saveIfModified
abstract boolean saveIfModified(@NonNull() String path)
Saves the document to passed location if it has been changed. If there were no changes to the document, the output file won't be modified. Note that this may take a while and should not be called on the main thread. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to which to save the document.
-
saveIfModified
abstract boolean saveIfModified(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to passed location if it has been changed. If there were no changes to the document, the output file won't be modified. Note that this may take a while and should not be called on the main thread. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to which to save the document.saveOptions
- Save options for the document.
-
saveAsync
@NonNull() abstract Completable saveAsync(@NonNull() String path)
Saves the document to an external file even if it hasn't been changed. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to the output document file.
-
saveAsync
@NonNull() abstract Completable saveAsync(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file even if it hasn't been changed. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to the output document file.saveOptions
- Save options for the document.
-
saveIfModifiedAsync
@NonNull() abstract Single<Boolean> saveIfModifiedAsync()
Saves the document back to original location if it has been changed. If there were no changes to the document, the document file will not be modified.
-
saveIfModifiedAsync
@NonNull() abstract Single<Boolean> saveIfModifiedAsync(@NonNull() DocumentSaveOptions saveOptions)
Saves the document back to original location if it has been changed. If there were no changes to the document, the document file will not be modified.
- Parameters:
saveOptions
- Save options for the document.
-
saveIfModifiedAsync
@NonNull() abstract Single<Boolean> saveIfModifiedAsync(@NonNull() String path)
Saves the document to an external file if it has been changed. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to which to save the document.
-
saveIfModifiedAsync
@NonNull() abstract Single<Boolean> saveIfModifiedAsync(@NonNull() String path, @NonNull() DocumentSaveOptions saveOptions)
Saves the document to an external file if it has been changed. This will not clear the wasModified flag on this document instance, and will not replace the source of this document either (i.e. subsequent calls to saveIfModified will still save the document back to the original file).
- Parameters:
path
- Absolute filepath to which to save the document.saveOptions
- Save options for the document, may benull
to use default set.
-
wasModified
abstract boolean wasModified()
Returns
true
if this document was modified and should be saved to retain changes.
-
getDefaultDocumentSaveOptions
@NonNull() abstract DocumentSaveOptions getDefaultDocumentSaveOptions()
Returns a default set of document save options which have same permissions, password and PDF version set as this document.
-
getTitle
@Nullable() abstract String getTitle()
Returns a document title. Resolved in this order:
- Document title from metadata
- Document title
-
getDocumentSignatureInfo
@NonNull() abstract DocumentSignatureInfo getDocumentSignatureInfo()
Returns information about digital signatures in this document. This call may block for a while and should not be called from the main thread.
-
getDocumentSignatureInfoAsync
@NonNull() abstract Single<DocumentSignatureInfo> getDocumentSignatureInfoAsync()
Returns information about digital signatures in this document. This will be executed on a background scheduler.
-
getCheckpointer
@Nullable() abstract PdfDocumentCheckpointer getCheckpointer()
Returns PdfDocumentCheckpointer object which handles the checkpoint for the document. May return
null
if checkpoint is not supported.
-
initPageCache
abstract void initPageCache()
Pre-fetches rotations, sizes and labels for all pages on a background thread. Caching will only be performed once (for the first caller). If you need a callback to be notified of when caching is done, use the async variant initPageCacheAsync instead.
-
initPageCacheAsync
@NonNull() abstract Completable initPageCacheAsync()
Pre-fetches rotations, sizes and labels for all pages on a background thread. Caching will only be performed once (for the first subscriber).
-
invalidateCache
abstract void invalidateCache()
Invalidates the rendered cache of all the pages for this
document
. Use this method if the document is not updated after a change, or changed externally, and needs to be re-rendered.Note: this call may block for a while and should not be invoked on the main thread.
-
invalidateCacheForPage
abstract void invalidateCacheForPage(@IntRange(from = 0) int pageIndex)
Invalidates the rendered cache of the given
pageIndex
for thisdocument
. Use this method if a single page of the document is not updated after a change, or changed externally, and needs to be re-rendered.Note: this call may block for a while and should not be invoked on the main thread.
- Parameters:
pageIndex
- 0-based index of the page to refresh.
-
isAutomaticLinkGenerationEnabled
abstract boolean isAutomaticLinkGenerationEnabled()
Whether or not automatic link generation is enabled. This property dictates if the document's text should be parsed and any clickable links automatically generated with its corresponding com.pspdfkit.annotations.LinkAnnotation
-
setAutomaticLinkGenerationEnabled
abstract void setAutomaticLinkGenerationEnabled(boolean enabled)
Enables or disables automatic link generation. This will parse the PDF page text and automatically generate clickable links (and corresponding objects) for text that looks like a HTTP or a similar link.
Enabled by default.
- Parameters:
enabled
-true
if link generation should be enabled,false
otherwise.
-
setWatermarkTextFilteringEnabled
abstract void setWatermarkTextFilteringEnabled(boolean enabled)
Enables or disables filtering of watermark text in text retrieval methods. Note that this will not prevent the rendering of the watermark on the page.
Affects getPageText (and overloads), getPageTextLength and getPageTextRects.
Enabled by default.
-
isWatermarkFilteringEnabled
abstract boolean isWatermarkFilteringEnabled()
Whether or not watermark filtering is enabled. setWatermarkTextFilteringEnabled dictates whether watermark text is filtered from text retrieval methods.
-
getPdfProjection
@NonNull() abstract PdfProjection getPdfProjection()
Returns auxiliary projection class for mapping coordinate space between raw and normalized Pdf.
-
setRotationOffset
abstract void setRotationOffset(int pageRotation, @IntRange(from = 0) int pageIndex)
Applies a temporary rotation to the specified page of this document. This will change the size reported by the document to match the new rotation. The document will not be modified by this. If you plan on applying a rotation to multiple pages use setRotationOffsets.
- Parameters:
pageRotation
- One of NO_ROTATION, ROTATION_90, ROTATION_180, ROTATION_270.pageIndex
- The page to apply the rotation to.
-
setRotationOffsets
abstract void setRotationOffsets(@NonNull() SparseIntArray pageRotations)
Applies a temporary rotation to the specified pages of this document. This will change the size reported by the document to match the new rotation. The document will not be modified by this. If you plan on applying a rotation to a single page use setRotationOffset.
- Parameters:
pageRotations
- A SparseIntArray mapping the page index to the desired rotation.
-
getJavaScriptProvider
@NonNull() abstract JavaScriptProvider getJavaScriptProvider()
Returns JavaScriptProvider object which handles JavaScript execution for this document.
-
getPageBinding
@NonNull() abstract PageBinding getPageBinding()
Returns the current document's PageBinding. This property sets how the document is displayed, either left to right (page indexed 0 will be to the left), or right to left (page indexed 0 will be on the right).
-
setPageBinding
abstract void setPageBinding(@NonNull() PageBinding pageBinding)
Sets the PageBinding controlling in which direction pages of documents are laid out. This will be stored in the document metadata and persisted when reopening the document.
- Parameters:
pageBinding
- The PageBinding to set on the document.
-
getHashForDocumentRange
abstract Array<byte> getHashForDocumentRange(@NonNull() List<Long> range, @NonNull() HashAlgorithm hashAlgorithm)
Returns the hash of a particular byte range of the document. This method works only on the first source of a compound document, use getHashForDocumentRange if you want to digest other sources.
- Parameters:
range
- The byte range of the part of the document that will be hashed.hashAlgorithm
- The hash algorithm that will be used to generate the hashed data.
-
getHashForDocumentRange
abstract Array<byte> getHashForDocumentRange(int sourceIndex, @NonNull() List<Long> range, @NonNull() HashAlgorithm hashAlgorithm)
Returns the hash of a particular byte range of the document.
- Parameters:
sourceIndex
- Index of document source that should be hashed (valid only for compound documents).range
- The byte range of the part of the document that will be hashed.hashAlgorithm
- The hash algorithm that will be used to generate the hashed data.
-
getSecondaryMeasurementUnit
@Nullable() abstract SecondaryMeasurementUnit getSecondaryMeasurementUnit()
Gets the secondary unit value from the document
-
setSecondaryMeasurementUnit
abstract void setSecondaryMeasurementUnit(@NonNull() SecondaryMeasurementUnit secondaryMeasurementUnit)
Sets the secondary unit value on the document.
- Parameters:
secondaryMeasurementUnit
- is the unit the user has selected
-
-
-
-