Package org.apache.fop.render.ps
Class ResourceHandler
java.lang.Object
org.apache.fop.render.ps.ResourceHandler
- All Implemented Interfaces:
PSSupportedFlavors
,org.apache.xmlgraphics.ps.dsc.DSCParserConstants
public class ResourceHandler
extends Object
implements org.apache.xmlgraphics.ps.dsc.DSCParserConstants, PSSupportedFlavors
This class is used when two-pass production is used to generate the PostScript file (setting
"optimize-resources"). It uses the DSC parser from XML Graphics Commons to go over the
temporary file generated by the PSRenderer and adds all used fonts and images as resources
to the PostScript file.
-
Field Summary
Fields inherited from interface org.apache.xmlgraphics.ps.dsc.DSCParserConstants
COMMENT, DSC_COMMENT, EOF, HEADER_COMMENT, LINE
Fields inherited from interface org.apache.fop.render.ps.PSSupportedFlavors
LEVEL_2_FLAVORS_FORM, LEVEL_2_FLAVORS_INLINE, LEVEL_3_FLAVORS_FORM, LEVEL_3_FLAVORS_INLINE
-
Constructor Summary
ConstructorDescriptionResourceHandler
(FOUserAgent userAgent, PSEventProducer eventProducer, FontInfo fontInfo, org.apache.xmlgraphics.ps.dsc.ResourceTracker resTracker, Map formResources) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
process
(InputStream in, OutputStream out, int pageCount, Rectangle2D documentBoundingBox, PSRenderingUtil psUtil) Rewrites the temporary PostScript file generated by PSRenderer adding all needed resources (fonts and images).
-
Constructor Details
-
ResourceHandler
public ResourceHandler(FOUserAgent userAgent, PSEventProducer eventProducer, FontInfo fontInfo, org.apache.xmlgraphics.ps.dsc.ResourceTracker resTracker, Map formResources) Main constructor.- Parameters:
userAgent
- the FO user agenteventProducer
- the event producerfontInfo
- the font informationresTracker
- the resource tracker to useformResources
- Contains all forms used by this document (maintained by PSRenderer)
-
-
Method Details
-
process
public void process(InputStream in, OutputStream out, int pageCount, Rectangle2D documentBoundingBox, PSRenderingUtil psUtil) throws org.apache.xmlgraphics.ps.dsc.DSCException, IOException Rewrites the temporary PostScript file generated by PSRenderer adding all needed resources (fonts and images).- Parameters:
in
- the InputStream for the temporary PostScript fileout
- the OutputStream to write the finished file topageCount
- the number of pages (given here because PSRenderer writes an "(atend)")documentBoundingBox
- the document's bounding box (given here because PSRenderer writes an "(atend)")psUtil
-- Throws:
org.apache.xmlgraphics.ps.dsc.DSCException
- If there's an error in the DSC structure of the PS fileIOException
- In case of an I/O error
-