Package com.helger.pdflayout
Class PageLayoutPDF
java.lang.Object
com.helger.pdflayout.PageLayoutPDF
- All Implemented Interfaces:
IPLVisitable
Main class for creating layouted PDFs. This class contains the meta data as
well as a list of
PLPageSet objects that represent a set of pages
with a consistent layouting scheme.- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanBy default certain parts of the created PDFs are compressed, to safe space.static final booleanBy default no PDF/A compliant PDF is created. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPageSet(PLPageSet aPageSet) Add a new page setcom.helger.commons.collection.impl.ICommonsList<? extends PLPageSet>final Stringfinal LocalDateTimefinal Stringfinal IPDDocumentCustomizerfinal Stringfinal Stringfinal Stringfinal booleanfinal booleancom.helger.commons.state.EChangeremovePageSet(PLPageSet aPageSet) final PageLayoutPDFrenderTo(IPDDocumentCustomizer aCustomizer, OutputStream aOS) Deprecated.Render this layout to aFile.renderTo(OutputStream aOS) Render this layout to an OutputStream.final PageLayoutPDFsetCompressPDF(boolean bCompressPDF) final PageLayoutPDFsetCreatePDF_A(boolean bCreatePDF_A) final PageLayoutPDFsetDocumentAuthor(String sDocumentAuthor) final PageLayoutPDFsetDocumentCreationDateTime(LocalDateTime aDocumentCreationDate) final PageLayoutPDFsetDocumentCreator(String sDocumentCreator) final PageLayoutPDFsetDocumentCustomizer(IPDDocumentCustomizer aDocumentCustomizer) final PageLayoutPDFsetDocumentKeywords(String sDocumentKeywords) final PageLayoutPDFsetDocumentSubject(String sDocumentSubject) final PageLayoutPDFsetDocumentTitle(String sDocumentTitle) com.helger.commons.state.EChangevisit(IPLVisitor aVisitor) Visit this object and all descendants
-
Field Details
-
DEFAULT_COMPRESS_PDF
public static final boolean DEFAULT_COMPRESS_PDFBy default certain parts of the created PDFs are compressed, to safe space.- See Also:
-
DEFAULT_CREATE_PDF_A
public static final boolean DEFAULT_CREATE_PDF_ABy default no PDF/A compliant PDF is created.- See Also:
-
-
Constructor Details
-
PageLayoutPDF
public PageLayoutPDF()Constructor. Initializes Author, CreationDate and Creator from classVendorInfo.
-
-
Method Details
-
isCompressPDF
public final boolean isCompressPDF()- Returns:
- if PDF content should be compressed or not.
-
setCompressPDF
- Parameters:
bCompressPDF-trueto enable creation of compressed PDFs,falseto disable it.- Returns:
- this for chaining
-
isCreatePDF_A
public final boolean isCreatePDF_A()- Returns:
- if PDF/A conformant PDF should be created or not.
- Since:
- 6.0.3
-
setCreatePDF_A
- Parameters:
bCreatePDF_A-trueto enable creation of PDF/A,falseto disable it.- Returns:
- this for chaining
- Since:
- 6.0.3
-
getDocumentAuthor
-
setDocumentAuthor
-
getDocumentCreationDateTime
-
setDocumentCreationDateTime
@Nonnull public final PageLayoutPDF setDocumentCreationDateTime(@Nullable LocalDateTime aDocumentCreationDate) -
getDocumentCreator
-
setDocumentCreator
-
getDocumentTitle
-
setDocumentTitle
-
getDocumentKeywords
-
setDocumentKeywords
-
getDocumentSubject
-
setDocumentSubject
-
getAllPageSets
-
addPageSet
Add a new page set- Parameters:
aPageSet- The page set to be added. May not benull.- Returns:
- this for chaining
-
removePageSet
-
getDocumentCustomizer
-
setDocumentCustomizer
@Nonnull public final PageLayoutPDF setDocumentCustomizer(@Nullable IPDDocumentCustomizer aDocumentCustomizer) -
visit
@Nonnull public com.helger.commons.state.EChange visit(@Nonnull IPLVisitor aVisitor) throws IOException Description copied from interface:IPLVisitableVisit this object and all descendants- Specified by:
visitin interfaceIPLVisitable- Parameters:
aVisitor- The visitor to use. May not benull.- Returns:
EChange.CHANGEDif something changed internally.- Throws:
IOException- on PDFBox error
-
renderTo
@Nonnull public PageLayoutPDF renderTo(@Nonnull @WillClose OutputStream aOS) throws PDFCreationException Render this layout to an OutputStream.- Parameters:
aOS- The output stream to write to. May not benull. Is closed automatically.- Returns:
- this for chaining
- Throws:
PDFCreationException- In case of an error
-
renderTo
@Nonnull @Deprecated public final PageLayoutPDF renderTo(@Nullable IPDDocumentCustomizer aCustomizer, @Nonnull @WillClose OutputStream aOS) throws PDFCreationException Deprecated.Since 5.1.0; CallsetDocumentCustomizer(IPDDocumentCustomizer)and thanrenderTo(OutputStream)Render this layout to an OutputStream.- Parameters:
aCustomizer- The customizer to be invoked before the document is written to the stream. May benull.aOS- The output stream to write to. May not benull. Is closed automatically.- Returns:
- this for chaining
- Throws:
PDFCreationException- In case of an error
-
renderTo
Render this layout to aFile.- Parameters:
aFile- The output stream to write to. May not benull. Is closed automatically.- Returns:
- this for chaining
- Throws:
PDFCreationException- In case of an errorIllegalArgumentException- In case the file cannot be opened for writing- Since:
- 5.1.0
-
setDocumentCustomizer(IPDDocumentCustomizer)and thanrenderTo(OutputStream)