|
fop 1.0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.fop.render.AbstractRenderer
org.apache.fop.render.PrintRenderer
org.apache.fop.render.AbstractPathOrientedRenderer
org.apache.fop.render.pdf.PDFRenderer
Renderer that renders areas to PDF.
| Field Summary | |
protected PDFResourceContext |
currentContext
the current annotation list to add annotations to |
protected PDFPage |
currentPage
the current page to add annotations to |
protected java.lang.String |
currentPageRef
the current page's PDF reference string (to avoid numerous function calls) |
protected PDFContentGenerator |
generator
The current content generator to produce PDF commands with |
protected java.util.Map |
idGoTos
Maps XSL-FO element IDs to PDFGoTo objects targeting the corresponding areas These objects may not all be fully filled in yet |
protected java.util.Map |
idPositions
Maps XSL-FO element IDs to their on-page XY-positions Must be used in conjunction with the page reference to fully specify the PDFGoTo details |
static java.lang.String |
MIME_TYPE
The MIME type for PDF |
static int |
NORMAL_PDF_RESOLUTION
Normal PDF resolution (72dpi) |
protected java.io.OutputStream |
ostream
The output stream to write the document to |
protected int |
pageHeight
page height |
protected java.util.Map |
pageReferences
Maps unique PageViewport key to PDF page reference |
protected PDFDocument |
pdfDoc
the PDF Document being created |
protected PDFResources |
pdfResources
the /Resources object of the PDF document being created |
protected org.apache.fop.render.pdf.PDFRenderingUtil |
pdfUtil
Utility class which enables all sorts of features that are not directly connected to the normal rendering process. |
protected java.util.List |
unfinishedGoTos
The PDFGoTos in idGoTos that are not complete yet |
protected static boolean |
WRITE_COMMENTS
Controls whether comments are written to the PDF stream. |
| Fields inherited from class org.apache.fop.render.AbstractPathOrientedRenderer |
FOX_TRANSFORM |
| Fields inherited from class org.apache.fop.render.PrintRenderer |
embedFontInfoList, fontInfo, fontResolver |
| Fields inherited from class org.apache.fop.render.AbstractRenderer |
containingBPPosition, containingIPPosition, currentBPPosition, currentIPPosition, currentPageViewport, log, userAgent |
| Fields inherited from interface org.apache.fop.render.pdf.PDFConfigurationConstants |
ENCRYPTION_PARAMS, KEY_DISABLE_SRGB_COLORSPACE, KEY_OUTPUT_PROFILE, NO_ANNOTATIONS, NO_COPY_CONTENT, NO_EDIT_CONTENT, NO_PRINT, OWNER_PASSWORD, PDF_A_MODE, PDF_X_MODE, USER_PASSWORD |
| Fields inherited from interface org.apache.fop.render.Renderer |
ROLE |
| Constructor Summary | |
PDFRenderer()
create the PDF renderer |
|
| Method Summary | |
protected void |
beginTextObject()
Indicates the beginning of a text object. |
protected java.util.List |
breakOutOfStateStack()
Breaks out of the state stack to handle fixed block-containers. |
protected void |
clip()
Clip an area. |
protected void |
clipRect(float x,
float y,
float width,
float height)
Clip using a rectangular area. |
protected void |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. |
protected void |
concatenateTransformationMatrix(java.awt.geom.AffineTransform at)
Concatenates the current transformation matrix with the given one, therefore establishing a new coordinate system. |
protected RendererContext |
createRendererContext(int x,
int y,
int width,
int height,
java.util.Map foreignAttributes)
Creates a RendererContext for an image. |
protected void |
drawBorderLine(float x1,
float y1,
float x2,
float y2,
boolean horz,
boolean startOrBefore,
int style,
java.awt.Color col)
Draw a border segment of an XSL-FO style border. |
protected void |
drawImage(java.lang.String url,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
Draw an image at the indicated location. |
protected void |
endTextObject()
Indicates the end of a text object. |
protected void |
endVParea()
Signals exit from a viewport area. Subclasses can restore transformation matrices valid before the viewport area was started. |
protected void |
escapeText(java.lang.String s,
int[] letterAdjust,
Font font,
AbstractTextArea parentArea)
Escapes text according to PDF rules. |
protected void |
escapeText(java.lang.String s,
int start,
int end,
int[] letterAdjust,
Font font,
AbstractTextArea parentArea)
Escapes text according to PDF rules. |
protected void |
fillRect(float x,
float y,
float width,
float height)
Fill a rectangular area. |
protected void |
finishIDGoTo(PDFGoTo gt,
java.awt.geom.Point2D.Float position)
Set XY position in the PDFGoTo and add it to the PDF trailer. |
protected void |
finishIDGoTo(PDFGoTo gt,
java.lang.String pdfPageRef,
java.awt.geom.Point2D.Float position)
Set page reference and XY position in the PDFGoTo and add it to the PDF trailer. |
protected void |
finishOpenGoTos()
Checks if there are any unfinished PDFGoTos left in the list and resolves them to a default position on the page. |
protected static java.lang.String |
format(float value)
Formats a float value (normally coordinates) as Strings. |
Graphics2DAdapter |
getGraphics2DAdapter()
|
java.lang.String |
getMimeType()
Get the MIME type of the renderer. |
protected PDFGoTo |
getPDFGoToForID(java.lang.String targetID,
java.lang.String pvKey)
Get a PDFGoTo pointing to the given id. |
protected java.lang.String |
getTargetableID(Area area)
Returns area's id if it is the first area in the document with that id (i.e. |
protected void |
lineTo(float x,
float y)
Appends a straight line segment from the current point to (x, y). |
protected void |
moveTo(float x,
float y)
Moves the current point to (x, y), omitting any connecting line segment. |
void |
placeImage(float x,
float y,
float w,
float h,
PDFXObject xobj)
Places a previously registered image at a certain place on the page. |
void |
preparePage(PageViewport page)
The pdf page is prepared by making the page. |
void |
processOffDocumentItem(OffDocumentItem odi)
Tells the renderer to process an item not explicitly placed on the document (e.g., PDF bookmarks). Note - not all renderers will process all off-document items. |
protected void |
putImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos)
Deprecated. Use putImage(String, Rectangle2D, Map) instead. |
protected void |
putImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
Adds a PDF XObject (a bitmap or form) to the PDF that will later be referenced. |
protected void |
renderBlock(Block block)
Renders a block area. |
protected void |
renderBookmarkTree(BookmarkData bookmarks)
Renders a Bookmark-Tree object |
void |
renderDocument(org.w3c.dom.Document doc,
java.lang.String ns,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
Renders an XML document (SVG for example). |
void |
renderImage(Image image,
java.awt.geom.Rectangle2D pos)
Renders an image area. |
protected void |
renderInlineArea(InlineArea inlineArea)
Render the given InlineArea. |
void |
renderInlineParent(InlineParent ip)
Render inline parent area. |
void |
renderLeader(Leader area)
Render leader area. |
protected void |
renderLineArea(LineArea line)
Renders a line area. A line area may have grouped styling for its children such as underline, background. |
void |
renderPage(PageViewport page)
This method creates a PDF stream for the current page uses it as the contents of a new page. |
void |
renderSpace(SpaceArea space)
Render the given SpaceArea. |
void |
renderText(TextArea text)
Render the given TextArea. |
void |
renderViewport(Viewport viewport)
Render an inline viewport. This renders an inline viewport by clipping if necessary. |
void |
renderWord(WordArea word)
Render the given WordArea. |
protected void |
restoreGraphicsState()
Restores the last graphics state of the rendering engine. |
protected void |
restoreStateStackAfterBreakOut(java.util.List breakOutList)
Restores the state stack after a break out. |
protected void |
saveAbsolutePosition(java.lang.String id,
int relativeIPP,
int relativeBPP)
Saves id's absolute position on page for later retrieval by PDFGoTos, using the currently valid transformation and the currently valid PDF page reference |
protected void |
saveAbsolutePosition(java.lang.String id,
java.lang.String pdfPageRef,
int relativeIPP,
int relativeBPP,
java.awt.geom.AffineTransform tf)
Saves id's absolute position on page for later retrieval by PDFGoTos |
protected void |
saveBlockPosIfTargetable(Block block)
If the given block area is a possible link target, its id + absolute position will be saved. |
protected void |
saveGraphicsState()
Saves the graphics state of the rendering engine. |
protected void |
saveInlinePosIfTargetable(InlineArea inlineArea)
If the given inline area is a possible link target, its id + absolute position will be saved. |
void |
setAMode(PDFAMode mode)
Sets the PDF/A mode for the PDF renderer. |
void |
setEncryptionParams(PDFEncryptionParams encryptionParams)
Sets the encryption parameters used by the PDF renderer. |
void |
setFilterMap(java.util.Map filterMap)
Sets the filter map to be used by the PDF renderer. |
void |
setOutputProfileURI(java.lang.String outputProfileURI)
Sets the output color profile for the PDF renderer. |
void |
setUserAgent(FOUserAgent agent)
Set the User Agent. |
void |
setXMode(PDFXMode mode)
Sets the PDF/X mode for the PDF renderer. |
void |
startPageSequence(PageSequence pageSequence)
Start the next page sequence. |
void |
startRenderer(java.io.OutputStream stream)
Initiates the rendering phase. This must only be called once for a rendering. If stopRenderer is called then this may be called again for a new document rendering. |
protected void |
startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
Establishes a new viewport area. |
void |
stopRenderer()
Signals the end of the rendering phase. The renderer should reset to an initial state and dispose of any resources for the completed rendering. |
boolean |
supportsOutOfOrder()
Check if this renderer supports out of order rendering. If this renderer supports out of order rendering then it means that the pages that are not ready will be prepared and a future page will be rendered. |
protected void |
updateColor(java.awt.Color col,
boolean fill)
Establishes a new foreground or fill color. |
| Methods inherited from class org.apache.fop.render.AbstractPathOrientedRenderer |
drawBackAndBorders, drawBackAndBorders, drawBackground, drawBorders, drawBorders, drawImage, establishTransformationMatrix, handleBlockTraits, handleRegionTraits, renderBlockViewport, renderFlow, renderForeignObject, renderInlineAreaBackAndBorders, renderReferenceArea, renderTextDecoration |
| Methods inherited from class org.apache.fop.render.PrintRenderer |
addFontList, getFontFromArea, getFontInfo, getFontList, getFontResolver, getInternalFontNameForArea, instantiateRendererContext, setFontList, setupFontInfo |
| Methods inherited from class org.apache.fop.render.AbstractRenderer |
convertTitleToString, getCurrentPageViewport, getImageAdapter, getUserAgent, mptToPt, ptToMpt, renderBeforeFloat, renderBlocks, renderBodyRegion, renderContainer, renderFootnote, renderInlineBlockParent, renderInlineSpace, renderMainReference, renderPageAreas, renderRegion, renderRegionViewport, renderXML, startPageSequence |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MIME_TYPE
public static final int NORMAL_PDF_RESOLUTION
protected static final boolean WRITE_COMMENTS
protected PDFDocument pdfDoc
protected org.apache.fop.render.pdf.PDFRenderingUtil pdfUtil
protected java.util.Map pageReferences
protected java.util.Map idPositions
protected java.util.Map idGoTos
protected java.util.List unfinishedGoTos
protected java.io.OutputStream ostream
protected PDFResources pdfResources
protected PDFContentGenerator generator
protected PDFResourceContext currentContext
protected PDFPage currentPage
protected java.lang.String currentPageRef
protected int pageHeight
| Constructor Detail |
public PDFRenderer()
| Method Detail |
public void setUserAgent(FOUserAgent agent)
setUserAgent in interface RenderersetUserAgent in class AbstractRenderer
public void startRenderer(java.io.OutputStream stream)
throws java.io.IOException
startRenderer in interface RendererstartRenderer in class AbstractRendererjava.io.IOExceptionprotected void finishOpenGoTos()
public void stopRenderer()
throws java.io.IOException
stopRenderer in interface RendererstopRenderer in class AbstractRendererjava.io.IOExceptionpublic boolean supportsOutOfOrder()
supportsOutOfOrder in interface RenderersupportsOutOfOrder in class AbstractRendererpublic void processOffDocumentItem(OffDocumentItem odi)
processOffDocumentItem in interface RendererprocessOffDocumentItem in class AbstractRendererprotected void renderBookmarkTree(BookmarkData bookmarks)
bookmarks - the BookmarkData object containing all the Bookmark-Itemspublic Graphics2DAdapter getGraphics2DAdapter()
getGraphics2DAdapter in interface RenderergetGraphics2DAdapter in class AbstractRendererprotected void saveGraphicsState()
saveGraphicsState in class AbstractPathOrientedRendererprotected void restoreGraphicsState()
restoreGraphicsState in class AbstractPathOrientedRendererprotected void beginTextObject()
beginTextObject in class AbstractPathOrientedRendererprotected void endTextObject()
endTextObject in class AbstractPathOrientedRendererpublic void startPageSequence(PageSequence pageSequence)
startPageSequence in interface RendererstartPageSequence in class AbstractRendererpageSequence - the page sequencepublic void preparePage(PageViewport page)
preparePage in interface RendererpreparePage in class AbstractRendererpage - the page to prepare
public void renderPage(PageViewport page)
throws java.io.IOException,
FOPException
renderPage in interface RendererrenderPage in class AbstractRendererjava.io.IOException
FOPException
protected void startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
startVParea in class AbstractRendererctm - the coordinate transformation matrix to useclippingRect - the clipping rectangle if the viewport should be clipping,
null if no clipping is performed.protected void endVParea()
endVParea in class AbstractRendererprotected void concatenateTransformationMatrix(java.awt.geom.AffineTransform at)
concatenateTransformationMatrix in class AbstractPathOrientedRendererat - the transformation matrix to process (coordinates in points)protected static java.lang.String format(float value)
value - the value
protected void drawBorderLine(float x1,
float y1,
float x2,
float y2,
boolean horz,
boolean startOrBefore,
int style,
java.awt.Color col)
drawBorderLine in class AbstractPathOrientedRendererx1 - starting x coordinatey1 - starting y coordinatex2 - ending x coordinatey2 - ending y coordinatehorz - true for horizontal border segments, false for vertical border segmentsstartOrBefore - true for border segments on the start or before edge,
false for end or after.style - the border style (one of Constants.EN_DASHED etc.)col - the color for the border segment
protected void clipRect(float x,
float y,
float width,
float height)
clipRect in class AbstractPathOrientedRendererx - the x coordinate (in points)y - the y coordinate (in points)width - the width of the rectangle (in points)height - the height of the rectangle (in points)protected void clip()
clip in class AbstractPathOrientedRenderer
protected void moveTo(float x,
float y)
moveTo in class AbstractPathOrientedRendererx - x coordinatey - y coordinate
protected void lineTo(float x,
float y)
lineTo in class AbstractPathOrientedRendererx - x coordinatey - y coordinateprotected void closePath()
closePath in class AbstractPathOrientedRenderer
protected void fillRect(float x,
float y,
float width,
float height)
fillRect in class AbstractPathOrientedRendererx - the x coordinatey - the y coordinatewidth - the width of the rectangleheight - the height of the rectangleprotected java.util.List breakOutOfStateStack()
breakOutOfStateStack in class AbstractPathOrientedRendererprotected void restoreStateStackAfterBreakOut(java.util.List breakOutList)
restoreStateStackAfterBreakOut in class AbstractPathOrientedRendererbreakOutList - the state stack to restore.protected java.lang.String getTargetableID(Area area)
area - the area for which to return the id
protected void finishIDGoTo(PDFGoTo gt,
java.awt.geom.Point2D.Float position)
gt - the PDFGoTo objectposition - the X,Y position to set
protected void finishIDGoTo(PDFGoTo gt,
java.lang.String pdfPageRef,
java.awt.geom.Point2D.Float position)
gt - the PDFGoTo objectpdfPageRef - the PDF reference string of the target page objectposition - the X,Y position to set
protected PDFGoTo getPDFGoToForID(java.lang.String targetID,
java.lang.String pvKey)
targetID - the target id of the PDFGoTopvKey - the unique key of the target PageViewport
protected void saveAbsolutePosition(java.lang.String id,
java.lang.String pdfPageRef,
int relativeIPP,
int relativeBPP,
java.awt.geom.AffineTransform tf)
id - the id of the area whose position must be savedpdfPageRef - the PDF page reference stringrelativeIPP - the *relative* IP position in millipointsrelativeBPP - the *relative* BP position in millipointstf - the transformation to apply once the relative positions have been
converted to points
protected void saveAbsolutePosition(java.lang.String id,
int relativeIPP,
int relativeBPP)
id - the id of the area whose position must be savedrelativeIPP - the *relative* IP position in millipointsrelativeBPP - the *relative* BP position in millipointsprotected void saveBlockPosIfTargetable(Block block)
block - the block area in questionprotected void saveInlinePosIfTargetable(InlineArea inlineArea)
inlineArea - the inline area in questionprotected void renderBlock(Block block)
renderBlock in class AbstractRendererblock - The block areaprotected void renderLineArea(LineArea line)
A line area may have grouped styling for its children such as underline, background.
renderLineArea in class AbstractRendererline - The line areaprotected void renderInlineArea(InlineArea inlineArea)
renderInlineArea in class AbstractRendererinlineArea - inline area text to renderpublic void renderInlineParent(InlineParent ip)
renderInlineParent in class AbstractRendererip - the inline parent areapublic void renderViewport(Viewport viewport)
renderViewport in class AbstractPathOrientedRendererviewport - the viewport to handlepublic void renderText(TextArea text)
renderText in class AbstractRenderertext - the text to renderpublic void renderWord(WordArea word)
renderWord in class AbstractRendererword - the word to renderpublic void renderSpace(SpaceArea space)
renderSpace in class AbstractRendererspace - the space to render
protected void escapeText(java.lang.String s,
int[] letterAdjust,
Font font,
AbstractTextArea parentArea)
s - Text to escapeletterAdjust - an array of widths for letter adjustment (may be null)font - to font in useparentArea - the parent text area to retrieve certain traits from
protected void escapeText(java.lang.String s,
int start,
int end,
int[] letterAdjust,
Font font,
AbstractTextArea parentArea)
s - Text to escapestart - the start position in the textend - the end position in the textletterAdjust - an array of widths for letter adjustment (may be null)font - to font in useparentArea - the parent text area to retrieve certain traits from
protected void updateColor(java.awt.Color col,
boolean fill)
updateColor in class AbstractPathOrientedRenderercol - the color to apply (null skips this operation)fill - true to set the fill color, false for the foreground color
public void renderImage(Image image,
java.awt.geom.Rectangle2D pos)
renderImage in class AbstractRendererimage - The imagepos - The target position of the image
(todo) Make renderImage() protected
protected void drawImage(java.lang.String url,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
drawImage in class AbstractPathOrientedRendererurl - the URI/URL of the imagepos - the position of the imageforeignAttributes - an optional Map with foreign attributes, may be null
protected void putImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos)
putImage(String, Rectangle2D, Map) instead.
uri - URL of the bitmappos - Position of the bitmap
protected void putImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
uri - URL of the bitmappos - Position of the bitmapforeignAttributes - foreign attributes associated with the image
public void placeImage(float x,
float y,
float w,
float h,
PDFXObject xobj)
x - X coordinatey - Y coordinatew - width for imageh - height for imagexobj - the image XObject
protected RendererContext createRendererContext(int x,
int y,
int width,
int height,
java.util.Map foreignAttributes)
createRendererContext in class PrintRendererx - the x coordinate (in millipoints)y - the y coordinate (in millipoints)width - the width of the image (in millipoints)height - the height of the image (in millipoints)foreignAttributes - a Map or foreign attributes, may be null
public void renderDocument(org.w3c.dom.Document doc,
java.lang.String ns,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
renderDocument in class PrintRendererdoc - the DOM Document containing the XML document to be renderedns - the namespace URI for the XML documentpos - the position for the generated graphic/imageforeignAttributes - the foreign attributes containing rendering hints, or nullpublic void renderLeader(Leader area)
renderLeader in class AbstractRendererarea - the leader area to renderpublic java.lang.String getMimeType()
getMimeType in interface Rendererpublic void setAMode(PDFAMode mode)
mode - the PDF/A modepublic void setXMode(PDFXMode mode)
mode - the PDF/X modepublic void setOutputProfileURI(java.lang.String outputProfileURI)
outputProfileURI - the URI to the output color profilepublic void setFilterMap(java.util.Map filterMap)
filterMap - the filter mappublic void setEncryptionParams(PDFEncryptionParams encryptionParams)
encryptionParams - the encryption parameters
|
fop 1.0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||