|
fop 0.93 | ||||||||||
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 java.lang.String |
currentFontName
Name of currently selected font |
protected int |
currentFontSize
Size of currently selected font |
protected PDFPage |
currentPage
the current page to add annotations to |
protected PDFState |
currentState
drawing state |
protected PDFStream |
currentStream
the current stream to add PDF commands to |
static java.lang.String |
ENCRYPTION_PARAMS
PDF encryption parameter: all parameters as object, datatype: PDFEncryptionParams |
protected PDFEncryptionParams |
encryptionParams
the (optional) encryption parameters |
protected java.util.Map |
filterMap
Registry of PDF filters |
protected boolean |
inTextMode
true if a BT command has been written. |
static java.lang.String |
KEY_OUTPUT_PROFILE
Rendering Options key for the ICC profile for the output intent. |
static java.lang.String |
MIME_TYPE
The mime type for pdf |
static java.lang.String |
NO_ANNOTATIONS
PDF encryption parameter: Forbids annotations, datatype: Boolean or "true"/"false" |
static java.lang.String |
NO_COPY_CONTENT
PDF encryption parameter: Forbids copying content, datatype: Boolean or "true"/"false" |
static java.lang.String |
NO_EDIT_CONTENT
PDF encryption parameter: Forbids editing content, datatype: Boolean or "true"/"false" |
static java.lang.String |
NO_PRINT
PDF encryption parameter: Forbids printing, datatype: Boolean or "true"/"false" |
static int |
NORMAL_PDF_RESOLUTION
Normal PDF resolution (72dpi) |
protected java.io.OutputStream |
ostream
The output stream to write the document to |
protected PDFICCStream |
outputProfile
the ICC stream used as output profile by this document for PDF/A and PDF/X functionality. |
protected java.lang.String |
outputProfileURI
Optional URI to an output profile to be used. |
static java.lang.String |
OWNER_PASSWORD
PDF encryption parameter: owner password, datatype: String |
protected int |
pageHeight
page height |
protected java.util.Map |
pageReferences
Page references are stored using the PageViewport as the key when a reference is made the PageViewport is used for pdf this means we need the pdf page reference |
protected java.util.Map |
pages
Map of pages using the PageViewport as the key this is used for prepared pages that cannot be immediately rendered |
static java.lang.String |
PDF_A_MODE
Rendering Options key for the PDF/A mode. |
static java.lang.String |
PDF_X_MODE
Rendering Options key for the PDF/X mode. |
protected PDFAMode |
pdfAMode
the PDF/A mode (Default: disabled) |
protected PDFDocument |
pdfDoc
the PDF Document being created |
protected PDFResources |
pdfResources
the /Resources object of the PDF document being created |
protected PDFXMode |
pdfXMode
the PDF/X mode (Default: disabled) |
protected java.util.Map |
pvReferences
Page viewport references |
protected PDFICCBasedColorSpace |
sRGBColorSpace
the default sRGB color space. |
static java.lang.String |
USER_PASSWORD
PDF encryption parameter: user password, datatype: String |
protected static boolean |
WRITE_COMMENTS
Controls whether comments are written to the PDF stream. |
Fields inherited from class org.apache.fop.render.PrintRenderer |
fontInfo, fontList |
Fields inherited from class org.apache.fop.render.AbstractRenderer |
containingBPPosition, containingIPPosition, currentBPPosition, currentIPPosition, currentPageViewport, log, userAgent |
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 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 |
closeText()
Checks to see if we have some text rendering commands open still and writes out the TJ command to the stream if we do |
protected void |
comment(java.lang.String text)
writes out a comment. |
void |
configure(org.apache.avalon.framework.configuration.Configuration cfg)
Configure the PDF renderer. |
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. |
void |
escapeText(java.lang.String s,
int[] letterAdjust,
Font fs,
AbstractTextArea parentArea,
boolean useMultiByte,
java.lang.StringBuffer pdf)
Escapes text according to PDF rules. |
protected void |
fillRect(float x,
float y,
float w,
float h)
Fill a rectangular area. |
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 void |
handleRegionTraits(RegionViewport region)
Handle the traits for a region This is used to draw the traits for the given page region. |
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. |
protected void |
placeImage(float x,
float y,
float w,
float h,
int 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). |
protected void |
putImage(java.lang.String url,
java.awt.geom.Rectangle2D pos)
Adds a PDF XObject (a bitmap) to the PDF that will later be referenced. |
protected void |
renderBookmarkTree(BookmarkData bookmarks)
Renders a Bookmark-Tree object |
void |
renderImage(Image image,
java.awt.geom.Rectangle2D pos)
Renders an image area. |
void |
renderInlineParent(InlineParent ip)
Render inline parent area. |
void |
renderLeader(Leader area)
Render leader area. |
protected void |
renderLineArea(LineArea line)
Renders a line area. |
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 |
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 |
saveGraphicsState()
Saves the graphics state of the rendering engine. |
protected void |
setColor(java.awt.Color col,
boolean fill,
java.lang.StringBuffer pdf)
Establishes a new foreground or fill color. |
void |
setUserAgent(FOUserAgent agent)
Set the User Agent. |
void |
startPageSequence(LineArea seqTitle)
Start the next page sequence. |
void |
startRenderer(java.io.OutputStream stream)
Initiates the rendering phase. |
protected void |
startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
Establishes a new viewport area. |
void |
stopRenderer()
Signals the end of the rendering phase. |
boolean |
supportsOutOfOrder()
Check if this renderer supports out of order rendering. |
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, drawBorders, drawImage, handleBlockTraits, renderBlockViewport, renderForeignObject, renderInlineAreaBackAndBorders, renderTextDecoration, renderViewport |
Methods inherited from class org.apache.fop.render.PrintRenderer |
getFontFromArea, getInternalFontNameForArea, lightenColor, renderDocument, setupFontInfo |
Methods inherited from class org.apache.fop.render.AbstractRenderer |
convertTitleToString, getCurrentPageViewport, getHandlerConfig, getImageAdapter, renderBeforeFloat, renderBlock, renderBlocks, renderBodyRegion, renderCharacter, renderContainer, renderFlow, renderFootnote, renderInlineArea, renderInlineBlockParent, renderInlineSpace, renderMainReference, renderPageAreas, renderRegion, renderRegionViewport, renderXML |
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
public static final java.lang.String ENCRYPTION_PARAMS
public static final java.lang.String USER_PASSWORD
public static final java.lang.String OWNER_PASSWORD
public static final java.lang.String NO_PRINT
public static final java.lang.String NO_COPY_CONTENT
public static final java.lang.String NO_EDIT_CONTENT
public static final java.lang.String NO_ANNOTATIONS
public static final java.lang.String PDF_A_MODE
public static final java.lang.String PDF_X_MODE
public static final java.lang.String KEY_OUTPUT_PROFILE
protected static final boolean WRITE_COMMENTS
protected PDFDocument pdfDoc
protected PDFAMode pdfAMode
protected PDFXMode pdfXMode
protected java.util.Map pages
protected java.util.Map pageReferences
protected java.util.Map pvReferences
protected java.io.OutputStream ostream
protected PDFResources pdfResources
protected PDFStream currentStream
protected PDFResourceContext currentContext
protected PDFPage currentPage
protected PDFEncryptionParams encryptionParams
protected PDFICCStream outputProfile
protected PDFICCBasedColorSpace sRGBColorSpace
protected java.lang.String outputProfileURI
protected PDFState currentState
protected java.lang.String currentFontName
protected int currentFontSize
protected int pageHeight
protected java.util.Map filterMap
protected boolean inTextMode
Constructor Detail |
public PDFRenderer()
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration cfg) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
configure
in class AbstractRenderer
org.apache.avalon.framework.configuration.ConfigurationException
Configurable.configure(Configuration)
public void setUserAgent(FOUserAgent agent)
Renderer
setUserAgent
in interface Renderer
setUserAgent
in class AbstractRenderer
Renderer.setUserAgent(FOUserAgent)
public void startRenderer(java.io.OutputStream stream) throws java.io.IOException
Renderer
startRenderer
in interface Renderer
startRenderer
in class AbstractRenderer
java.io.IOException
Renderer.startRenderer(OutputStream)
public void stopRenderer() throws java.io.IOException
Renderer
stopRenderer
in interface Renderer
stopRenderer
in class AbstractRenderer
java.io.IOException
Renderer.stopRenderer()
public boolean supportsOutOfOrder()
AbstractRenderer
supportsOutOfOrder
in interface Renderer
supportsOutOfOrder
in class AbstractRenderer
Renderer.supportsOutOfOrder()
public void processOffDocumentItem(OffDocumentItem odi)
Renderer
processOffDocumentItem
in interface Renderer
processOffDocumentItem
in class AbstractRenderer
Renderer.processOffDocumentItem(OffDocumentItem)
protected void renderBookmarkTree(BookmarkData bookmarks)
bookmarks
- the BookmarkData object containing all the Bookmark-Itemspublic Graphics2DAdapter getGraphics2DAdapter()
getGraphics2DAdapter
in interface Renderer
getGraphics2DAdapter
in class AbstractRenderer
Renderer.getGraphics2DAdapter()
protected void comment(java.lang.String text)
text
- text for the commentprotected void saveGraphicsState()
saveGraphicsState
in class AbstractPathOrientedRenderer
protected void restoreGraphicsState()
restoreGraphicsState
in class AbstractPathOrientedRenderer
protected void beginTextObject()
beginTextObject
in class AbstractPathOrientedRenderer
protected void endTextObject()
endTextObject
in class AbstractPathOrientedRenderer
public void startPageSequence(LineArea seqTitle)
startPageSequence
in interface Renderer
startPageSequence
in class AbstractRenderer
seqTitle
- the title of the page sequenceRenderer.startPageSequence(LineArea)
public void preparePage(PageViewport page)
preparePage
in interface Renderer
preparePage
in class AbstractRenderer
page
- the page to prepareRenderer.preparePage(PageViewport)
public void renderPage(PageViewport page) throws java.io.IOException, FOPException
renderPage
in interface Renderer
renderPage
in class AbstractRenderer
java.io.IOException
FOPException
Renderer.renderPage(PageViewport)
protected void startVParea(CTM ctm, java.awt.geom.Rectangle2D clippingRect)
AbstractRenderer
startVParea
in class AbstractRenderer
ctm
- the coordinate transformation matrix to useclippingRect
- the clipping rectangle if the viewport should be clipping,
null if no clipping is performed.AbstractRenderer.startVParea(CTM, Rectangle2D)
protected void endVParea()
AbstractRenderer
endVParea
in class AbstractRenderer
AbstractRenderer.endVParea()
protected void handleRegionTraits(RegionViewport region)
handleRegionTraits
in class AbstractPathOrientedRenderer
region
- the RegionViewport whose region is to be drawnprotected static final 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)
AbstractPathOrientedRenderer
drawBorderLine
in class AbstractPathOrientedRenderer
x1
- 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 segmentAbstractPathOrientedRenderer
protected void clipRect(float x, float y, float width, float height)
clipRect
in class AbstractPathOrientedRenderer
x
- the x coordinatey
- the y coordinatewidth
- the width of the areaheight
- the height of the areaprotected void clip()
clip
in class AbstractPathOrientedRenderer
protected void moveTo(float x, float y)
moveTo
in class AbstractPathOrientedRenderer
x
- x coordinatey
- y coordinateprotected void lineTo(float x, float y)
lineTo
in class AbstractPathOrientedRenderer
x
- x coordinatey
- y coordinateprotected void closePath()
closePath
in class AbstractPathOrientedRenderer
protected void fillRect(float x, float y, float w, float h)
AbstractPathOrientedRenderer
fillRect
in class AbstractPathOrientedRenderer
x
- the x coordinatey
- the y coordinatew
- the width of the rectangleh
- the height of the rectangleAbstractPathOrientedRenderer.fillRect(float, float, float, float)
protected java.util.List breakOutOfStateStack()
breakOutOfStateStack
in class AbstractPathOrientedRenderer
protected void restoreStateStackAfterBreakOut(java.util.List breakOutList)
restoreStateStackAfterBreakOut
in class AbstractPathOrientedRenderer
breakOutList
- the state stack to restore.protected void renderLineArea(LineArea line)
AbstractRenderer
A line area may have grouped styling for its children such as underline, background.
renderLineArea
in class AbstractRenderer
line
- The line areaAbstractRenderer.renderLineArea(LineArea)
public void renderInlineParent(InlineParent ip)
renderInlineParent
in class AbstractRenderer
ip
- the inline parent areapublic void renderText(TextArea text)
AbstractRenderer
renderText
in class AbstractRenderer
text
- the text to renderAbstractRenderer.renderText(TextArea)
public void renderWord(WordArea word)
AbstractRenderer
renderWord
in class AbstractRenderer
word
- the word to renderAbstractRenderer.renderWord(WordArea)
public void renderSpace(SpaceArea space)
AbstractRenderer
renderSpace
in class AbstractRenderer
space
- the space to renderAbstractRenderer.renderSpace(SpaceArea)
public void escapeText(java.lang.String s, int[] letterAdjust, Font fs, AbstractTextArea parentArea, boolean useMultiByte, java.lang.StringBuffer pdf)
s
- Text to escapeletterAdjust
- an array of widths for letter adjustment (may be null)fs
- Font stateparentArea
- the parent text area to retrieve certain traits fromuseMultiByte
- Indicates the use of multi byte conventionpdf
- target buffer for the escaped textprotected void closeText()
protected void setColor(java.awt.Color col, boolean fill, java.lang.StringBuffer pdf)
col
- the color to applyfill
- true to set the fill color, false for the foreground colorpdf
- StringBuffer to write the PDF code to, if null, the code is
written to the current stream.protected void updateColor(java.awt.Color col, boolean fill)
AbstractPathOrientedRenderer
updateColor
in class AbstractPathOrientedRenderer
col
- the color to apply (null skips this operation)fill
- true to set the fill color, false for the foreground colorAbstractPathOrientedRenderer
public void renderImage(Image image, java.awt.geom.Rectangle2D pos)
AbstractRenderer
renderImage
in class AbstractRenderer
image
- The imagepos
- The target position of the image
(todo) Make renderImage() protectedAbstractRenderer.renderImage(Image, Rectangle2D)
protected void drawImage(java.lang.String url, java.awt.geom.Rectangle2D pos, java.util.Map foreignAttributes)
AbstractPathOrientedRenderer
drawImage
in class AbstractPathOrientedRenderer
url
- the URI/URL of the imagepos
- the position of the imageforeignAttributes
- an optional Map with foreign attributes, may be nullAbstractPathOrientedRenderer
protected void putImage(java.lang.String url, java.awt.geom.Rectangle2D pos)
url
- URL of the bitmappos
- Position of the bitmapprotected void placeImage(float x, float y, float w, float h, int xobj)
x
- X coordinatey
- Y coordinatew
- width for imageh
- height for imagexobj
- object number of the referenced imageprotected RendererContext createRendererContext(int x, int y, int width, int height, java.util.Map foreignAttributes)
PrintRenderer
createRendererContext
in class PrintRenderer
x
- 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
PrintRenderer.createRendererContext(
int, int, int, int, java.util.Map)
public void renderLeader(Leader area)
renderLeader
in class AbstractRenderer
area
- the leader area to renderpublic java.lang.String getMimeType()
AbstractRenderer
getMimeType
in interface Renderer
getMimeType
in class AbstractRenderer
AbstractRenderer
|
fop 0.93 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |