Class PSRenderingUtil


  • public class PSRenderingUtil
    extends java.lang.Object
    Utility class which enables all sorts of features that are not directly connected to the normal rendering process.
    • Field Detail

      • safeSetPageDevice

        private boolean safeSetPageDevice
        Whether or not the safe set page device macro will be used or not
      • dscCompliant

        private boolean dscCompliant
        Whether or not PostScript Document Structuring Conventions (DSC) compliant output are enforced.
      • autoRotateLandscape

        private boolean autoRotateLandscape
      • languageLevel

        private int languageLevel
      • acrobatDownsample

        private boolean acrobatDownsample
      • optimizeResources

        private boolean optimizeResources
        Determines whether the PS file is generated in two passes to minimize file size
      • renderingMode

        private PSRenderingMode renderingMode
        Determines whether the generated PostScript code is optimized for minimum file size of best quality.
    • Constructor Detail

      • PSRenderingUtil

        PSRenderingUtil​(FOUserAgent userAgent)
    • Method Detail

      • initialize

        private void initialize()
      • booleanValueOf

        private boolean booleanValueOf​(java.lang.Object obj)
      • intValueOf

        private int intValueOf​(java.lang.Object obj)
      • writeSetupCodeList

        public static void writeSetupCodeList​(org.apache.xmlgraphics.ps.PSGenerator gen,
                                              java.util.List setupCodeList,
                                              java.lang.String type)
                                       throws java.io.IOException
        Formats and writes a List of PSSetupCode instances to the output stream.
        Parameters:
        gen - the PS generator
        setupCodeList - a List of PSSetupCode instances
        type - the type of code section
        Throws:
        java.io.IOException - if an I/O error occurs.
      • writeEnclosedExtensionAttachments

        public static void writeEnclosedExtensionAttachments​(org.apache.xmlgraphics.ps.PSGenerator gen,
                                                             java.util.Collection attachmentCollection)
                                                      throws java.io.IOException
        Formats and writes a Collection of PSExtensionAttachment instances to the output stream. The instances are removed from the collection when they have been written.
        Parameters:
        gen - the PS generator
        attachmentCollection - a Collection of PSExtensionAttachment instances
        Throws:
        java.io.IOException - if an I/O error occurs.
      • writeEnclosedExtensionAttachment

        public static void writeEnclosedExtensionAttachment​(org.apache.xmlgraphics.ps.PSGenerator gen,
                                                            PSExtensionAttachment attachment)
                                                     throws java.io.IOException
        Formats and writes a PSExtensionAttachment to the output stream.
        Parameters:
        gen - the PS generator
        attachment - an PSExtensionAttachment instance
        Throws:
        java.io.IOException - if an I/O error occurs.
      • setSafeSetPageDevice

        public void setSafeSetPageDevice​(boolean value)
        Sets whether or not PostScript Document Structuring Conventions (DSC) compliance are enforced.

        It can cause problems (unwanted PostScript subsystem initgraphics/erasepage calls) on some printers when the pagedevice is set. If this causes problems on a particular implementation then use this setting with a 'false' value to try and minimize the number of setpagedevice calls in the PostScript document output.

        Set this value to false if you experience unwanted blank pages in your PostScript output.

        Parameters:
        value - boolean value (default is true)
      • isSafeSetPageDevice

        public boolean isSafeSetPageDevice()
        Indicates whether the "safe setpagedevice" mode is active. See setSafeSetPageDevice(boolean) for more information.
        Returns:
        true if active
      • setDSCComplianceEnabled

        public void setDSCComplianceEnabled​(boolean value)
        Sets whether or not the safe set page device macro should be used (as opposed to directly invoking setpagedevice) when setting the PostScript page device.

        This option is a useful option when you want to guard against the possibility of invalid/unsupported PostScript key/values being placed in the page device.

        Parameters:
        value - setting to false and the renderer will make a standard "setpagedevice" call, setting to true will make a safe set page device macro call (default is false).
      • isDSCComplianceEnabled

        public boolean isDSCComplianceEnabled()
        Returns:
        true if DSC complicance is enabled
      • setAutoRotateLandscape

        public void setAutoRotateLandscape​(boolean value)
        Controls whether landscape pages should be rotated.
        Parameters:
        value - true to enable the rotation
      • isAutoRotateLandscape

        public boolean isAutoRotateLandscape()
        Indicates whether landscape pages are rotated.
        Returns:
        true if landscape pages are to be rotated
      • setLanguageLevel

        public void setLanguageLevel​(int level)
        Sets the PostScript language level.
        Parameters:
        level - the PostScript language level (Only 2 and 3 are currently supported)
      • getLanguageLevel

        public int getLanguageLevel()
        Indicates the selected PostScript language level.
        Returns:
        the PostScript language level
      • setAcrobatDownsample

        public void setAcrobatDownsample​(boolean b)
      • isAcrobatDownsample

        public boolean isAcrobatDownsample()
      • setOptimizeResources

        public void setOptimizeResources​(boolean value)
        Controls whether PostScript resources are optimized in a second pass over the document. Enable this to obtain smaller PostScript files.
        Parameters:
        value - true to enable resource optimization
      • isOptimizeResources

        public boolean isOptimizeResources()
        Indicates whether PostScript resources are optimized in a second pass over the document.
        Returns:
        true if resource optimization is enabled
      • setRenderingMode

        public void setRenderingMode​(PSRenderingMode renderingMode)
        Sets the rendering mode.
        Parameters:
        renderingMode - the rendering mode
      • getRenderingMode

        public PSRenderingMode getRenderingMode()
        Returns the rendering mode.
        Returns:
        the rendering mode