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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLanguageLevel()
      Indicates the selected PostScript language level.
      org.apache.fop.render.ps.PSRenderingMode getRenderingMode()
      Returns the rendering mode.
      boolean isAcrobatDownsample()  
      boolean isAutoRotateLandscape()
      Indicates whether landscape pages are rotated.
      boolean isDSCComplianceEnabled()  
      boolean isOptimizeResources()
      Indicates whether PostScript resources are optimized in a second pass over the document.
      boolean isSafeSetPageDevice()
      Indicates whether the "safe setpagedevice" mode is active.
      void setAcrobatDownsample​(boolean b)  
      void setAutoRotateLandscape​(boolean value)
      Controls whether landscape pages should be rotated.
      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.
      void setLanguageLevel​(int level)
      Sets the PostScript language level.
      void setOptimizeResources​(boolean value)
      Controls whether PostScript resources are optimized in a second pass over the document.
      void setRenderingMode​(org.apache.fop.render.ps.PSRenderingMode renderingMode)
      Sets the rendering mode.
      void setSafeSetPageDevice​(boolean value)
      Sets whether or not PostScript Document Structuring Conventions (DSC) compliance are enforced.
      static void writeEnclosedExtensionAttachment​(org.apache.xmlgraphics.ps.PSGenerator gen, PSExtensionAttachment attachment)
      Formats and writes a PSExtensionAttachment to the output stream.
      static void writeEnclosedExtensionAttachments​(org.apache.xmlgraphics.ps.PSGenerator gen, java.util.Collection attachmentCollection)
      Formats and writes a Collection of PSExtensionAttachment instances to the output stream.
      static void writeSetupCodeList​(org.apache.xmlgraphics.ps.PSGenerator gen, java.util.List setupCodeList, java.lang.String type)
      Formats and writes a List of PSSetupCode instances to the output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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​(org.apache.fop.render.ps.PSRenderingMode renderingMode)
        Sets the rendering mode.
        Parameters:
        renderingMode - the rendering mode
      • getRenderingMode

        public org.apache.fop.render.ps.PSRenderingMode getRenderingMode()
        Returns the rendering mode.
        Returns:
        the rendering mode