Package com.helger.pdflayout
Class PageLayoutPDF
- java.lang.Object
-
- com.helger.pdflayout.PageLayoutPDF
-
- All Implemented Interfaces:
IPLVisitable
@NotThreadSafe public class PageLayoutPDF extends Object implements IPLVisitable
Main class for creating layouted PDFs. This class contains the meta data as well as a list ofPLPageSetobjects that represent a set of pages with a consistent layouting scheme.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_COMPRESS_PDFBy default certain parts of the created PDFs are compressed, to safe space.static booleanDEFAULT_CREATE_PDF_ABy default no PDF/A compliant PDF is created.
-
Constructor Summary
Constructors Constructor Description PageLayoutPDF()Constructor.
-
Method Summary
-
-
-
Field Detail
-
DEFAULT_COMPRESS_PDF
public static final boolean DEFAULT_COMPRESS_PDF
By default certain parts of the created PDFs are compressed, to safe space.- See Also:
- Constant Field Values
-
DEFAULT_CREATE_PDF_A
public static final boolean DEFAULT_CREATE_PDF_A
By default no PDF/A compliant PDF is created.- See Also:
- Constant Field Values
-
-
Method Detail
-
isCompressPDF
public final boolean isCompressPDF()
- Returns:
- if PDF content should be compressed or not.
-
setCompressPDF
@Nonnull public final PageLayoutPDF setCompressPDF(boolean bCompressPDF)
- 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
@Nonnull public final PageLayoutPDF setCreatePDF_A(boolean bCreatePDF_A)
- Parameters:
bCreatePDF_A-trueto enable creation of PDF/A,falseto disable it.- Returns:
- this for chaining
- Since:
- 6.0.3
-
setDocumentAuthor
@Nonnull public final PageLayoutPDF setDocumentAuthor(@Nullable String sDocumentAuthor)
-
getDocumentCreationDateTime
@Nullable public final LocalDateTime getDocumentCreationDateTime()
-
setDocumentCreationDateTime
@Nonnull public final PageLayoutPDF setDocumentCreationDateTime(@Nullable LocalDateTime aDocumentCreationDate)
-
setDocumentCreator
@Nonnull public final PageLayoutPDF setDocumentCreator(@Nullable String sDocumentCreator)
-
setDocumentTitle
@Nonnull public final PageLayoutPDF setDocumentTitle(@Nullable String sDocumentTitle)
-
setDocumentKeywords
@Nonnull public final PageLayoutPDF setDocumentKeywords(@Nullable String sDocumentKeywords)
-
setDocumentSubject
@Nonnull public final PageLayoutPDF setDocumentSubject(@Nullable String sDocumentSubject)
-
getAllPageSets
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<? extends PLPageSet> getAllPageSets()
-
addPageSet
@Nonnull public PageLayoutPDF addPageSet(@Nonnull PLPageSet aPageSet)
Add a new page set- Parameters:
aPageSet- The page set to be added. May not benull.- Returns:
- this for chaining
-
removePageSet
@Nonnull public com.helger.commons.state.EChange removePageSet(@Nullable PLPageSet aPageSet)
-
getDocumentCustomizer
@Nullable public final IPDDocumentCustomizer 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
@Nonnull public PageLayoutPDF renderTo(@Nonnull File aFile) throws PDFCreationException
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
-
-