Class PdfRendererBuilder

    • Constructor Detail

      • PdfRendererBuilder

        public PdfRendererBuilder()
    • Method Detail

      • run

        public void run()
                 throws IOException
        Run the XHTML/XML to PDF conversion and output to an output stream set by toStream.
        Throws:
        IOException
      • toStream

        public PdfRendererBuilder toStream​(OutputStream out)
        An output stream to output the resulting PDF. The caller is required to close the output stream after calling run.
        Parameters:
        out -
        Returns:
      • usePdfVersion

        public PdfRendererBuilder usePdfVersion​(float version)
        Set the PDF version, typically we use 1.7. If you set a lower version, it is your responsibility to make sure no more recent PDF features are used.
        Parameters:
        version -
        Returns:
      • usePdfAConformance

        public PdfRendererBuilder usePdfAConformance​(PdfRendererBuilder.PdfAConformance pdfAConformance)
        Set the PDF/A conformance, typically we use PDF/A-1 Note: PDF/A documents require fonts to be embedded. So if this is not set to NONE, the built-in fonts will not be available and currently any text without a specified and embedded font will cause the renderer to crash with an exception.
        Parameters:
        pdfAConformance -
        Returns:
      • usePdfUaAccessbility

        public PdfRendererBuilder usePdfUaAccessbility​(boolean pdfUaAccessibility)
        Whether to conform to PDF/UA or Accessible PDF. False by default.
        Parameters:
        pdfUaAccessibility -
        Returns:
        this for method chaining
      • useColorProfile

        public PdfRendererBuilder useColorProfile​(byte[] colorProfile)
        Sets the color profile, needed for PDF/A conformance. You can use the sRGB.icc from https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/resources/org/apache/pdfbox/resources/pdfa/
        Parameters:
        colorProfile -
        Returns:
      • usePDDocument

        public PdfRendererBuilder usePDDocument​(org.apache.pdfbox.pdmodel.PDDocument doc)
        By default, this project creates an entirely in-memory PDDocument. The user can use this method to create a document either entirely on-disk or a mix of in-memory and on-disk using the PDDocument constructor that takes a MemoryUsageSetting.
        Parameters:
        doc - a (usually empty) PDDocument
        Returns:
        this for method chaining
      • withProducer

        public PdfRendererBuilder withProducer​(String producer)
        Set a producer on the output document
        Parameters:
        producer - the name of the producer to set defaults to openhtmltopdf.com
        Returns:
        this for method chaining
      • usePageSupplier

        public PdfRendererBuilder usePageSupplier​(PageSupplier pageSupplier)
        Set a PageSupplier that is called whenever a new page is needed.
        Parameters:
        pageSupplier - PageSupplier to use
        Returns:
        this for method chaining.
      • useSlowMode

        @Deprecated
        public PdfRendererBuilder useSlowMode()
        Deprecated.
        Fast mode is the default from version 1.0.5. You can call this temporary method to use the slow renderer until it is removed in a near future version. This method is marked deprecated to prompt you to upgrade to the fast renderer.
        Returns:
        this for method chaining.