Package org.apache.fop.render.ps
Class PSRenderingUtil
- java.lang.Object
-
- org.apache.fop.render.ps.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 Summary
Fields Modifier and Type Field Description private boolean
acrobatDownsample
private boolean
autoRotateLandscape
private boolean
dscCompliant
Whether or not PostScript Document Structuring Conventions (DSC) compliant output are enforced.private int
languageLevel
private boolean
optimizeResources
Determines whether the PS file is generated in two passes to minimize file sizeprivate PSRenderingMode
renderingMode
Determines whether the generated PostScript code is optimized for minimum file size of best quality.private boolean
safeSetPageDevice
Whether or not the safe set page device macro will be used or notprivate FOUserAgent
userAgent
-
Constructor Summary
Constructors Constructor Description PSRenderingUtil(FOUserAgent userAgent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
booleanValueOf(java.lang.Object obj)
int
getLanguageLevel()
Indicates the selected PostScript language level.PSRenderingMode
getRenderingMode()
Returns the rendering mode.private void
initialize()
private int
intValueOf(java.lang.Object obj)
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(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.
-
-
-
Field Detail
-
userAgent
private FOUserAgent userAgent
-
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 generatorsetupCodeList
- a List of PSSetupCode instancestype
- 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 generatorattachmentCollection
- 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 generatorattachment
- 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. SeesetSafeSetPageDevice(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
-
-