public final class

PdfProcessor

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.processor.PdfProcessor

Class Overview

Copy, merge or modify PDF documents. It also allows flattening and filtering of annotation data.

Summary

Nested Classes
class PdfProcessor.ProcessorProgress Object representing processing progress. 
Public Methods
static void processDocument(PdfProcessorTask task, File outputFile)
Starts the document processing on current thread.
static void processDocument(PdfProcessorTask task, File outputFile, DocumentSaveOptions saveOptions)
Starts the document processing on current thread.
static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync(PdfProcessorTask task, OutputStream outputStream, DocumentSaveOptions saveOptions)
Starts the document processing.
static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync(PdfProcessorTask task, OutputStream outputStream)
Starts the document processing, using the default DocumentSaveOptions for the processed document.
static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync(PdfProcessorTask task, File outputFile)
Starts the document processing, using the default DocumentSaveOptions for the processed document.
static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync(PdfProcessorTask task, File outputFile, DocumentSaveOptions saveOptions)
Starts the document processing.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void processDocument (PdfProcessorTask task, File outputFile)

Starts the document processing on current thread. This will use the default DocumentSaveOptions for the processed document.

NOTE: Document processing can take time do not run it on main thread.

Parameters
task Defined processing task.
outputFile Output PDF file to be written.
Throws
PdfProcessorException if there was an issue while processing.
IllegalStateException If the outputFile points to the original input file.

public static void processDocument (PdfProcessorTask task, File outputFile, DocumentSaveOptions saveOptions)

Starts the document processing on current thread.

NOTE: Document processing can take time do not run it on main thread.

Parameters
task Defined processing task.
outputFile Output PDF file to be written.
saveOptions Save options defining password protection, permissions, etc.
Throws
PdfProcessorException if there was an issue while processing.
IllegalStateException If the outputFile points to the original input file.

public static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync (PdfProcessorTask task, OutputStream outputStream, DocumentSaveOptions saveOptions)

Starts the document processing.

NOTE: This does not work with stripEmptyPages(boolean) as it needs to reopen processed document which is not possible with OutputStream.

NOTE: Returned observable doesn't have target thread set so use subscribeOn(Scheduler) to choose the thread to run processing on.

Parameters
task Defined processing task.
outputStream Output stream for writing output PDF data.
saveOptions Save options defining password protection, permissions, etc.
Returns
  • Observable which will periodically emit progress objects until processing is complete.

public static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync (PdfProcessorTask task, OutputStream outputStream)

Starts the document processing, using the default DocumentSaveOptions for the processed document.

NOTE: This does not work with stripEmptyPages(boolean) as it needs to reopen processed document which is not possible with OutputStream.

NOTE: Returned observable doesn't have target thread set so use subscribeOn(Scheduler) to choose the thread to run processing on.

Parameters
task Defined processing task.
outputStream Output stream for writing output PDF data.
Returns
  • Observable which will periodically emit progress objects until processing is complete.

public static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync (PdfProcessorTask task, File outputFile)

Starts the document processing, using the default DocumentSaveOptions for the processed document.

NOTE: Returned observable doesn't have target thread set so use subscribeOn(Scheduler) to choose the thread to run processing on.

Parameters
task Defined processing task.
outputFile Output PDF file to be written.
Returns
  • Observable which will periodically emit progress objects until processing is complete.
Throws
IllegalStateException If the outputFile points to the original input file.

public static Flowable<PdfProcessor.ProcessorProgress> processDocumentAsync (PdfProcessorTask task, File outputFile, DocumentSaveOptions saveOptions)

Starts the document processing.

NOTE: Returned observable doesn't have target thread set so use subscribeOn(Scheduler) to choose the thread to run processing on.

Parameters
task Defined processing task.
outputFile Output PDF file to be written.
saveOptions Save options defining password protection, permissions, etc.
Returns
  • Observable which will periodically emit progress objects until processing is complete.
Throws
IllegalStateException If the outputFile points to the original input file.