Package org.apache.fop.render.pdf
Class PDFRenderingUtil
- java.lang.Object
-
- org.apache.fop.render.pdf.PDFRenderingUtil
-
class PDFRenderingUtil extends java.lang.Object
Utility class which enables all sorts of features that are not directly connected to the normal rendering process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PDFRenderingUtil.EncryptionParamsBuilder
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.Log
log
logging instanceprivate PDFICCStream
outputProfile
the ICC stream used as output profile by this document for PDF/A and PDF/X functionality.private PDFDocument
pdfDoc
the PDF Document being createdprivate PDFRendererOptionsConfig
rendererConfig
private PDFICCBasedColorSpace
sRGBColorSpace
the default sRGB color space.private FOUserAgent
userAgent
-
Constructor Summary
Constructors Constructor Description PDFRenderingUtil(FOUserAgent userAgent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addDefaultOutputProfile()
void
addEmbeddedFile(PDFEmbeddedFileAttachment embeddedFile)
Adds an embedded file to the PDF file.void
addLayer(PDFDictionaryExtension extension)
void
addNavigator(PDFDictionaryExtension extension)
void
addNavigatorAction(PDFDictionaryExtension extension)
private void
addPDFA1OutputIntent()
Adds an OutputIntent to the PDF as mandated by PDF/A-1 when uncalibrated color spaces are used (which is true if we use DeviceRGB to represent sRGB colors).private void
addPDFXOutputIntent()
Adds an OutputIntent to the PDF as mandated by PDF/X when uncalibrated color spaces are used (which is true if we use DeviceRGB to represent sRGB colors).private void
addsRGBColorSpace()
private PDFArray
augmentArray(PDFArray array, PDFArrayExtension extension)
private void
augmentArray(PDFArray array, PDFCollectionEntryExtension entry)
private void
augmentDictionary(PDFDictionary dictionary, PDFCollectionEntryExtension entry)
private PDFDictionary
augmentDictionary(PDFDictionary dictionary, PDFDictionaryExtension extension)
protected static PDFRendererOptionsConfig
createFromUserAgent(FOUserAgent userAgent)
void
generateDefaultXMPMetadata()
void
generatePageLabel(int pageIndex, java.lang.String pageNumber)
Generates a page label in the PDF document.private boolean
hasKeyedEntry(java.util.List<?> entries)
private void
initialize()
private java.lang.Object
makeArray(java.lang.Object value)
private java.lang.Object
makeDictionary(java.lang.Object value)
private java.lang.Object
makeDictionaryOrArray(java.lang.Object value)
(package private) void
mergeRendererOptionsConfig(PDFRendererOptionsConfig config)
private java.lang.Object
populateArray(PDFArray array, java.util.List<?> entries)
private java.lang.Object
populateDictionary(PDFDictionary dictionary, java.util.List<?> entries)
void
renderDictionaryExtension(PDFDictionaryAttachment attachment, PDFPage currentPage)
void
renderDictionaryExtension(PDFDictionaryExtension extension, PDFPage currentPage)
private void
renderExtension(PDFPage currentPage, ExtensionAttachment extension)
void
renderXMPMetadata(XMPMetadata metadata)
private java.lang.Object
resolveReference(PDFReferenceExtension entry)
PDFDocument
setupPDFDocument(java.io.OutputStream out)
private void
updateInfo()
private void
updatePDFProfiles()
-
-
-
Field Detail
-
log
private static org.apache.commons.logging.Log log
logging instance
-
userAgent
private FOUserAgent userAgent
-
pdfDoc
private PDFDocument pdfDoc
the PDF Document being created
-
rendererConfig
private PDFRendererOptionsConfig rendererConfig
-
outputProfile
private PDFICCStream outputProfile
the ICC stream used as output profile by this document for PDF/A and PDF/X functionality.
-
sRGBColorSpace
private PDFICCBasedColorSpace sRGBColorSpace
the default sRGB color space.
-
-
Constructor Detail
-
PDFRenderingUtil
PDFRenderingUtil(FOUserAgent userAgent)
-
-
Method Detail
-
initialize
private void initialize()
-
createFromUserAgent
protected static PDFRendererOptionsConfig createFromUserAgent(FOUserAgent userAgent)
-
mergeRendererOptionsConfig
void mergeRendererOptionsConfig(PDFRendererOptionsConfig config)
-
updateInfo
private void updateInfo()
-
updatePDFProfiles
private void updatePDFProfiles()
-
addsRGBColorSpace
private void addsRGBColorSpace() throws java.io.IOException
- Throws:
java.io.IOException
-
addDefaultOutputProfile
private void addDefaultOutputProfile() throws java.io.IOException
- Throws:
java.io.IOException
-
addPDFA1OutputIntent
private void addPDFA1OutputIntent() throws java.io.IOException
Adds an OutputIntent to the PDF as mandated by PDF/A-1 when uncalibrated color spaces are used (which is true if we use DeviceRGB to represent sRGB colors).- Throws:
java.io.IOException
- in case of an I/O problem
-
addPDFXOutputIntent
private void addPDFXOutputIntent() throws java.io.IOException
Adds an OutputIntent to the PDF as mandated by PDF/X when uncalibrated color spaces are used (which is true if we use DeviceRGB to represent sRGB colors).- Throws:
java.io.IOException
- in case of an I/O problem
-
renderXMPMetadata
public void renderXMPMetadata(XMPMetadata metadata)
-
generateDefaultXMPMetadata
public void generateDefaultXMPMetadata()
-
renderDictionaryExtension
public void renderDictionaryExtension(PDFDictionaryAttachment attachment, PDFPage currentPage)
-
addLayer
public void addLayer(PDFDictionaryExtension extension)
-
addNavigatorAction
public void addNavigatorAction(PDFDictionaryExtension extension)
-
addNavigator
public void addNavigator(PDFDictionaryExtension extension)
-
makeArray
private java.lang.Object makeArray(java.lang.Object value)
-
populateArray
private java.lang.Object populateArray(PDFArray array, java.util.List<?> entries)
-
makeDictionary
private java.lang.Object makeDictionary(java.lang.Object value)
-
populateDictionary
private java.lang.Object populateDictionary(PDFDictionary dictionary, java.util.List<?> entries)
-
makeDictionaryOrArray
private java.lang.Object makeDictionaryOrArray(java.lang.Object value)
-
hasKeyedEntry
private boolean hasKeyedEntry(java.util.List<?> entries)
-
renderDictionaryExtension
public void renderDictionaryExtension(PDFDictionaryExtension extension, PDFPage currentPage)
-
renderExtension
private void renderExtension(PDFPage currentPage, ExtensionAttachment extension)
-
augmentDictionary
private PDFDictionary augmentDictionary(PDFDictionary dictionary, PDFDictionaryExtension extension)
-
augmentDictionary
private void augmentDictionary(PDFDictionary dictionary, PDFCollectionEntryExtension entry)
-
resolveReference
private java.lang.Object resolveReference(PDFReferenceExtension entry)
-
augmentArray
private PDFArray augmentArray(PDFArray array, PDFArrayExtension extension)
-
augmentArray
private void augmentArray(PDFArray array, PDFCollectionEntryExtension entry)
-
setupPDFDocument
public PDFDocument setupPDFDocument(java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
generatePageLabel
public void generatePageLabel(int pageIndex, java.lang.String pageNumber)
Generates a page label in the PDF document.- Parameters:
pageIndex
- the index of the pagepageNumber
- the formatted page number
-
addEmbeddedFile
public void addEmbeddedFile(PDFEmbeddedFileAttachment embeddedFile) throws java.io.IOException
Adds an embedded file to the PDF file.- Parameters:
embeddedFile
- the object representing the embedded file to be added- Throws:
java.io.IOException
- if an I/O error occurs
-
-