Class DocumentAssembler
- All Implemented Interfaces:
AutoCloseable
The class for splitting or merging PDF documents
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentAssembler(Stream outStream) DocumentAssembler(Stream outStream, OutputOptions outOptions) DocumentAssembler(Stream outStream, OutputOptions outOptions, Conformance conformance) -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method copies document properties and a range of pages frominDoc.voidThis method copies document properties and a range of pages frominDoc.voidThis method copies document properties and a range of pages frominDoc.voidappend(Document inDoc, Integer firstPage, Integer lastPage, DocumentCopyOptions documentCopyOptions) This method copies document properties and a range of pages frominDoc.voidappend(Document inDoc, Integer firstPage, Integer lastPage, DocumentCopyOptions documentCopyOptions, PageCopyOptions pageCopyOptions) This method copies document properties and a range of pages frominDoc.assemble()Assemble the input documentsvoidclose()Close the object.Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
Constructor Details
-
DocumentAssembler
- Parameters:
outStream- The stream to which the output PDF is written- Throws:
LicenseException- The license check has failed.IllegalArgumentException- An invalid encryption was specified inoutOptions}.invalid @link
{@link com.pdftools.documentassembly.DocumentAssembler#IOException- Unable to write to the stream.GenericException- A generic error occurred.IllegalArgumentException- ifoutStreamisnull
-
DocumentAssembler
public DocumentAssembler(Stream outStream, OutputOptions outOptions) throws IOException, GenericException, LicenseException - Parameters:
outStream- The stream to which the output PDF is writtenoutOptions- The PDF output options, e.g. to encrypt the output document.- Throws:
LicenseException- The license check has failed.IllegalArgumentException- An invalid encryption was specified inoutOptions}.invalid @link
{@link com.pdftools.documentassembly.DocumentAssembler#IOException- Unable to write to the stream.GenericException- A generic error occurred.IllegalArgumentException- ifoutStreamisnull
-
DocumentAssembler
public DocumentAssembler(Stream outStream, OutputOptions outOptions, Conformance conformance) throws IOException, GenericException, LicenseException - Parameters:
outStream- The stream to which the output PDF is writtenoutOptions- The PDF output options, e.g. to encrypt the output document.conformance-The required conformance level of the PDF document. Adding pages or content from incompatible documents or using incompatible features will lead to a conformance error.
When using
null, the conformance is determined automatically, based on the conformance of the input documents used in theappend(com.pdftools.pdf.Document)method and the requirements of the used features.- Throws:
LicenseException- The license check has failed.IllegalArgumentException- An invalid encryption was specified inoutOptions}.invalid @link
{@link com.pdftools.documentassembly.DocumentAssembler#IOException- Unable to write to the stream.GenericException- A generic error occurred.IllegalArgumentException- ifoutStreamisnull
-
-
Method Details
-
append
public void append(Document inDoc) throws LicenseException, ConformanceException, ProcessingException This method copies document properties and a range of pages frominDoc.- Parameters:
inDoc-- Throws:
LicenseException- The license check has failed.IllegalArgumentException- ThefirstPageorlastPageare not in the allowed range.IllegalArgumentException- If the method has already been called with any of the following properties set totrue:ConformanceException- The conformance level of the input document is not compatible with the conformance level of the output document.ConformanceException- The explicitly requested conformance level is PDF/A Level A (,invalid reference
pdftools.pdf.Conformance.PDF_A1_A, orinvalid reference
pdftools.pdf.Conformance.PDF_A2_A) and the copy optioninvalid reference
pdftools.pdf.Conformance.PDF_A3_APageCopyOptions.getCopyLogicalStructure()is set tofalse.IllegalStateException- Ifassemble()has already been called.ProcessingException- The processing has failed.IllegalArgumentException- ifinDocisnull
-
append
public void append(Document inDoc, Integer firstPage) throws LicenseException, ConformanceException, ProcessingException This method copies document properties and a range of pages frominDoc.- Parameters:
inDoc-firstPage-Optional parameter denoting the index of the first page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
1is used.- Throws:
LicenseException- The license check has failed.IllegalArgumentException- ThefirstPageorlastPageare not in the allowed range.IllegalArgumentException- If the method has already been called with any of the following properties set totrue:ConformanceException- The conformance level of the input document is not compatible with the conformance level of the output document.ConformanceException- The explicitly requested conformance level is PDF/A Level A (,invalid reference
pdftools.pdf.Conformance.PDF_A1_A, orinvalid reference
pdftools.pdf.Conformance.PDF_A2_A) and the copy optioninvalid reference
pdftools.pdf.Conformance.PDF_A3_APageCopyOptions.getCopyLogicalStructure()is set tofalse.IllegalStateException- Ifassemble()has already been called.ProcessingException- The processing has failed.IllegalArgumentException- ifinDocisnull
-
append
public void append(Document inDoc, Integer firstPage, Integer lastPage) throws LicenseException, ConformanceException, ProcessingException This method copies document properties and a range of pages frominDoc.- Parameters:
inDoc-firstPage-Optional parameter denoting the index of the first page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
1is used.lastPage-Optional parameter denoting the index of the last page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
pdftools.pdf.Document.getPageCountis used.- Throws:
LicenseException- The license check has failed.IllegalArgumentException- ThefirstPageorlastPageare not in the allowed range.IllegalArgumentException- If the method has already been called with any of the following properties set totrue:ConformanceException- The conformance level of the input document is not compatible with the conformance level of the output document.ConformanceException- The explicitly requested conformance level is PDF/A Level A (,invalid reference
pdftools.pdf.Conformance.PDF_A1_A, orinvalid reference
pdftools.pdf.Conformance.PDF_A2_A) and the copy optioninvalid reference
pdftools.pdf.Conformance.PDF_A3_APageCopyOptions.getCopyLogicalStructure()is set tofalse.IllegalStateException- Ifassemble()has already been called.ProcessingException- The processing has failed.IllegalArgumentException- ifinDocisnull
-
append
public void append(Document inDoc, Integer firstPage, Integer lastPage, DocumentCopyOptions documentCopyOptions) throws LicenseException, ConformanceException, ProcessingException This method copies document properties and a range of pages frominDoc.- Parameters:
inDoc-firstPage-Optional parameter denoting the index of the first page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
1is used.lastPage-Optional parameter denoting the index of the last page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
pdftools.pdf.Document.getPageCountis used.documentCopyOptions-- Throws:
LicenseException- The license check has failed.IllegalArgumentException- ThefirstPageorlastPageare not in the allowed range.IllegalArgumentException- If the method has already been called with any of the following properties set totrue:ConformanceException- The conformance level of the input document is not compatible with the conformance level of the output document.ConformanceException- The explicitly requested conformance level is PDF/A Level A (,invalid reference
pdftools.pdf.Conformance.PDF_A1_A, orinvalid reference
pdftools.pdf.Conformance.PDF_A2_A) and the copy optioninvalid reference
pdftools.pdf.Conformance.PDF_A3_APageCopyOptions.getCopyLogicalStructure()is set tofalse.IllegalStateException- Ifassemble()has already been called.ProcessingException- The processing has failed.IllegalArgumentException- ifinDocisnull
-
append
public void append(Document inDoc, Integer firstPage, Integer lastPage, DocumentCopyOptions documentCopyOptions, PageCopyOptions pageCopyOptions) throws LicenseException, ConformanceException, ProcessingException This method copies document properties and a range of pages frominDoc.- Parameters:
inDoc-firstPage-Optional parameter denoting the index of the first page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
1is used.lastPage-Optional parameter denoting the index of the last page to be copied. This index is one-based. If set, the number must be in the range of
1(first page) topdftools.pdf.Document.getPageCount(last page).If not set,
pdftools.pdf.Document.getPageCountis used.documentCopyOptions-pageCopyOptions-- Throws:
LicenseException- The license check has failed.IllegalArgumentException- ThefirstPageorlastPageare not in the allowed range.IllegalArgumentException- If the method has already been called with any of the following properties set totrue:ConformanceException- The conformance level of the input document is not compatible with the conformance level of the output document.ConformanceException- The explicitly requested conformance level is PDF/A Level A (,invalid reference
pdftools.pdf.Conformance.PDF_A1_A, orinvalid reference
pdftools.pdf.Conformance.PDF_A2_A) and the copy optioninvalid reference
pdftools.pdf.Conformance.PDF_A3_APageCopyOptions.getCopyLogicalStructure()is set tofalse.IllegalStateException- Ifassemble()has already been called.ProcessingException- The processing has failed.IllegalArgumentException- ifinDocisnull
-
assemble
Assemble the input documents
The input documents appended withappend(com.pdftools.pdf.Document)are assembled into the output PDF.- Returns:
- The assembled PDF, which can be used as a new input for further processing.
- Throws:
IllegalStateException- Ifassemble()has already been called.
-
close
Close the object.
Release all resources associated with the object.- Specified by:
closein interfaceAutoCloseable- Throws:
PdfToolsException- only explicitly stated in a superclassIOException
-