Class 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.
    • Field Detail

      • log

        private static org.apache.commons.logging.Log log
        logging instance
      • pdfDoc

        private PDFDocument pdfDoc
        the PDF Document being created
      • outputProfile

        private PDFICCStream outputProfile
        the ICC stream used as output profile by this document for PDF/A and PDF/X functionality.
    • Constructor Detail

      • PDFRenderingUtil

        PDFRenderingUtil​(FOUserAgent userAgent)
    • Method Detail

      • initialize

        private void initialize()
      • 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()
      • 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)
      • 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 page
        pageNumber - 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