java.lang.Object | |
↳ | com.pspdfkit.document.processor.PdfProcessorTask |
Represents a processing task for PdfProcessor
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | PdfProcessorTask.AnnotationProcessingMode | Describes how an annotation will be processed by a processor. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PdfProcessorTask |
addCanvasDrawingToPage(PageCanvas pageCanvas, int destinationPageIndex)
Merges content of canvas drawing on top (or below) the destination page content.
| ||||||||||
PdfProcessorTask |
addImageToPage(PageImage image, int destinationPageIndex)
Adds an image on top (or below) the destination page content.
| ||||||||||
PdfProcessorTask |
addNewPage(NewPage newPage, int destinationPageIndex)
Adds a new page to the document at passed index.
| ||||||||||
PdfProcessorTask |
applyRedactions()
Applies the redact annotations for the given page index.
| ||||||||||
PdfProcessorTask |
changeAllAnnotations(PdfProcessorTask.AnnotationProcessingMode processingMode)
Changes ALL annotations in document according to
PdfProcessorTask.AnnotationProcessingMode . | ||||||||||
PdfProcessorTask |
changeAnnotations(List<Annotation> annotations, PdfProcessorTask.AnnotationProcessingMode processingMode)
Changes passed annotations according to passed
PdfProcessorTask.AnnotationProcessingMode . | ||||||||||
PdfProcessorTask |
changeAnnotationsOfType(AnnotationType annotationType, PdfProcessorTask.AnnotationProcessingMode processingMode)
Changes all annotation of a certain type according to the passed in processing mode.
| ||||||||||
PdfProcessorTask |
changeFormsOfType(FormType formType, PdfProcessorTask.AnnotationProcessingMode processingMode)
Changes all form annotations of a certain type according to the passed in processing mode.
| ||||||||||
PdfProcessorTask |
changeStrokeColorOnPage(int pageIndex, int color)
Adjusts color of all strokes on the given page.
| ||||||||||
PdfProcessorTask |
clearPageLabels()
Removes all page labels in the document.
| ||||||||||
static PdfProcessorTask |
empty()
Creates a new empty processing task for the
PdfProcessor . | ||||||||||
static PdfProcessorTask |
fromDocument(PdfDocument sourceDocument)
Creates a new processing task for the
PdfProcessor . | ||||||||||
PdfProcessorTask |
keepPages(Set<Integer> pagesToKeep)
Keeps only passed pages from document.
| ||||||||||
PdfProcessorTask |
mergePage(PagePdf pagePdf, int destinationPageIndex)
Merges a page with a page of the task's document.
| ||||||||||
PdfProcessorTask |
mergePage(PagePdf pagePdf, int destinationPageIndex, BlendMode blendMode)
Merges a page with a page of the task's document by using specified
BlendMode . | ||||||||||
PdfProcessorTask |
movePages(Set<Integer> pagesToMove, int destinationIndex)
Moves passed pages to a new index in the document.
| ||||||||||
static PdfProcessorTask |
newPage(NewPage newPage)
Creates a new processing task for creating a new single-page document from scratch.
| ||||||||||
PdfProcessorTask |
performOcrOnPages(Set<Integer> pageIndexes, OcrLanguage ocrLanguage)
Performs optical character recognition on the provided set of pages in the PDF document.
| ||||||||||
PdfProcessorTask |
removePages(Set<Integer> pagesToRemove)
Removes passed pages from document.
| ||||||||||
PdfProcessorTask |
resizePage(int pageIndex, Size pageSize)
Re-sizes the selected page to
pageSize . | ||||||||||
PdfProcessorTask |
rotatePage(int pageIndex, int rotation)
Rotates the selected page for passed degrees.
| ||||||||||
PdfProcessorTask |
setFormFieldNameMappings(Map<String, String> formFieldNameMappings)
Renames form fields as described in a mapping.
| ||||||||||
PdfProcessorTask |
setFormMappingNameMappings(Map<String, String> formMappingNameMappings)
Renames form mapping names as described in this mapping.
| ||||||||||
PdfProcessorTask |
setPageBox(int pageIndex, PdfBox boxToChange, RectF rectF)
Changes one of the page boxes for the passed page.
| ||||||||||
PdfProcessorTask |
setPageLabel(int pageIndex, String label)
Sets a label on the page.
| ||||||||||
PdfProcessorTask |
stripEmptyPages(boolean stripEmptyPages)
Strip empty pages at the end of processing.
| ||||||||||
PdfProcessorTask |
withMetadata(HashMap<String, String> metadata)
Sets metadata for the output document.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Merges content of canvas drawing on top (or below) the destination page content.
pageCanvas | Canvas drawing to be merged. |
---|---|
destinationPageIndex | Page index of page to add PDF to. |
Adds an image on top (or below) the destination page content.
image | Image to be added to the page. |
---|---|
destinationPageIndex | Page index of page to add image to. |
Adds a new page to the document at passed index.
Note: This call requires document editing feature in your license.
newPage | Configuration setting size and rotation of the new page. |
---|---|
destinationPageIndex | Page index position of the destination where page should be added. |
PdfProcessorException | If new page contains a bitmap that cannot be opened |
---|
Applies the redact annotations for the given page index. Applying a redact annotation means removing the text that is underneath them, and removing the redact annotations themselves.
NOTE: This requires the Redaction component license to use.
Changes ALL annotations in document according to PdfProcessorTask.AnnotationProcessingMode
. By default
all annotations are kept (KEEP
).
processingMode | Processing mode for annotations in the document. |
---|
Changes passed annotations according to passed PdfProcessorTask.AnnotationProcessingMode
. By default,
all annotations are kept (KEEP
).
annotations | List of annotations to specify processing mode for. The annotations must be part of a source document. |
---|---|
processingMode | Processing mode for annotations in the list. |
Changes all annotation of a certain type according to the passed in processing mode.
annotationType | Annotation type to change. |
---|---|
processingMode | PdfProcessorTask.AnnotationProcessingMode describing how to change annotations. |
Changes all form annotations of a certain type according to the passed in processing mode.
formType | Form type to change. |
---|---|
processingMode | PdfProcessorTask.AnnotationProcessingMode describing how to change annotations. |
Adjusts color of all strokes on the given page.
Note: This call requires document comparison features in your license.
pageIndex | Index of the page, whose stroke color should be changed. |
---|---|
color | The new color used to change the strokes. |
Removes all page labels in the document.
Creates a new empty processing task for the PdfProcessor
.
Note: This call requires document editing feature in your license.
Creates a new processing task for the PdfProcessor
. By default the processing task
copies all pages and all annotations to the destination document.
Note: This call requires document editing feature in your license.
sourceDocument | The processed PdfDocument .
|
---|
Keeps only passed pages from document.
Note: This will shift page indices for any other operation accepting page index as a parameter after this!
pagesToKeep | Pages to keep in the document. |
---|
Merges a page with a page of the task's document.
pagePdf | PDF page to be merged. |
---|---|
destinationPageIndex | Index of the destination document's page the source page should be merged into. |
Merges a page with a page of the task's document by using specified BlendMode
.
Note: This call requires document comparison feature in your license.
pagePdf | PDF page to be merged. This call does not support PagePosition
property of the PagePdf . |
---|---|
destinationPageIndex | Index of the destination document's page the source page should be merged into. |
blendMode | Defines how the two pages should be blended into each other. |
Moves passed pages to a new index in the document. The order of pages in new location is retained.
Note: This will shift page indices for any other operation accepting page index as a parameter after this!
pagesToMove | 0-indexed set of page indexes of pages to remove. |
---|---|
destinationIndex | Index of position where pages should be moved to in source document. |
Creates a new processing task for creating a new single-page document from scratch.
Note: This call requires document editing feature in your license.
newPage | NewPage options for the first page of the new document.
|
---|
Performs optical character recognition on the provided set of pages in the PDF document.
In order to use this feature, you need to include the PSPDFKit OCR dependencies in your
framework. If using Gradle, you can add to your build.gradle
file:
final String pspdfkit_version = {@value com.pspdfkit.PSPDFKit#VERSION};
dependencies {
// Add the OCR component to your app.
implementation "com.pspdfkit:pspdfkit-ocr:$pspdfkit_version"
// Add one or multiple language packs for OCR.
implementation "com.pspdfkit:pspdfkit-ocr-english:$pspdfkit_version"
}
NOTE: In order to use this, your license requires to have the OCR
component enabled. Also, the language you pass in as a parameter needs to have a respective
OCR language pack added to the dependencies. See OcrLanguage
for a list of available
languages.
For additional guidance on how to integrate and use OCR inside your app, please visit https://pspdfkit.com/guides/android/current/ocr/getting-started.
pageIndexes | Pages that should be used in OCR processing. |
---|---|
ocrLanguage | OcrLanguage for OCR processing. |
Removes passed pages from document.
Note: This will shift page indices for any other operation accepting page index as a parameter after this!
pagesToRemove | 0-indexed set of page indexes of pages to remove. |
---|
Re-sizes the selected page to pageSize
. The content of the page will be resized with
kept aspect ratio. NOTE: This call requires document editing feature in your license.
pageIndex | 0-indexed page index of the page to be rotated. |
---|---|
pageSize | Size of the scaled page. |
Rotates the selected page for passed degrees. The pages can only be rotated for 0, 90, 180 or 270.
Note: This call requires document editing feature in your license.
pageIndex | 0-indexed page index of the page to be rotated. |
---|---|
rotation | Rotation in degrees. Positive number is clockwise rotation, negative is counter-clockwise. The value may only be 0, 90, 180 or 270. |
Renames form fields as described in a mapping.
NOTE: This requires the Document Editor component license to use.
formFieldNameMappings | Map of old name - new name pairs for this document. |
---|
Renames form mapping names as described in this mapping.
NOTE: This requires the Document Editor component license to use.
formMappingNameMappings | Map of old name - new name pairs for this document. |
---|
Changes one of the page boxes for the passed page.
Note: This call requires document editing feature in your license.
pageIndex | 0-indexed page index of the page to be rotated. |
---|---|
boxToChange | Current PDF box to be changed. |
rectF | New box position in PDF coordinates. |
Sets a label on the page. Most viewers will show the page label instead of its page number in both the document view and table of contents.
pageIndex | 0-indexed page index of the page to set the label to. |
---|---|
label | Label to be set for the page. If null , the label of the page will be
removed. |
Strip empty pages at the end of processing.
stripEmptyPages | true if empty pages should be stripped when writing processed
document. |
---|
Sets metadata for the output document. The set metadata will fully replace any existing metadata.