Top Methods
com.openhtmltopdf.pdfboxout

public Interface PdfBoxOutputDevice

extends OutputDevice
Known Direct Implementers
com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice, com.openhtmltopdf.pdfboxout.PdfBoxFastOutputDevice
Imports
java.awt.Paint, .Rectangle, .Shape, .Stroke, .RenderingHints.Key, java.awt.geom.AffineTransform, java.util.List, java.util.regex.Pattern, org.apache.pdfbox.pdmodel.PDDocument, .PDPage, .PDPageContentStream, org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject, org.w3c.dom.Document, com.openhtmltopdf.bidi.BidiReorderer, com.openhtmltopdf.css.parser.FSColor, com.openhtmltopdf.css.style.CssContext, com.openhtmltopdf.extend.FSImage, .OutputDevice, .OutputDeviceGraphicsDrawer, com.openhtmltopdf.layout.SharedContext, com.openhtmltopdf.pdfboxout.PdfBoxFontResolver.FontDescription, .PdfBoxSlowOutputDevice.Metadata, com.openhtmltopdf.render.BlockBox, .Box, .FSFont, .InlineText, .JustificationInfo, .RenderingContext

Method Summary

Modifier and TypeMethod and Description
public void
addMetadata(String
the name of the metadata element to add.
name
,
String value)

Appends a name/content metadata pair to this output device.

public void
public void
close()

Perform any internal cleanup needed

public void
public void
drawBorderLine(Shape bounds, int side, int lineWidth, boolean solid)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawBorderLine.

public void
drawImage(FSImage fsImage, int x, int y, boolean interpolate)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawImage.

public void
drawOval(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawOval.

public void
drawPdfAsImage(PDFormXObject _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)

public void
drawRect(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawRect.

public void
public void
drawString(String s, float x, float y, JustificationInfo info)

public void
drawStringFast(String s, float x, float y, JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize)

public void
drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawWithGraphics.

Draw something using a Graphics2D at the given rectangle.

public void
public void
fillOval(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.fillOval.

public void
fillRect(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.fillRect.

public List<PagePosition<Box>>
public void
public void
public float
public float
public Shape
public PdfContentStreamAdapter
public float
getDeviceLength(float length)

Given a value in dots units, converts to PDF points.

public float
public List<PdfBoxSlowOutputDevice.Metadata>
public String

Returns:

the content value of the first found metadata element; otherwise null.
getMetadataByName
(String
the metadata element name to locate.
name
)

Searches the metadata name/content pairs of the current document and returns the content value from the first pair with a matching name.

public List<String>

Returns:

an ArrayList with matching content values; otherwise an empty list.
getMetadataListByName
(String
the metadata element name to locate.
name
)

Searches the metadata name/content pairs of the current document and returns any content values with a matching name in an ArrayList.

public PDPage
public int
public Object
public SharedContext
public int
public Stroke
public PDDocument
public void
initializePage(PDPageContentStream currentPage, PDPage page, float height)

Start a page.

public boolean
isFastRenderer()

Redeclares com.openhtmltopdf.extend.OutputDevice.isFastRenderer.

The new (2018) fast renderer is in use.

public boolean
public boolean
public boolean
public float
normalizeY(float y, float pageHeight)

Converts a top down unit to a bottom up PDF unit for the specified page height.

public void
paintBackground(RenderingContext c, Box box)

Redeclares com.openhtmltopdf.extend.OutputDevice.paintBackground.

We use paintBackground to do extra stuff such as processing links, forms and form controls.

public void
public void
popClip()

Redeclares com.openhtmltopdf.extend.OutputDevice.popClip.

Reverts the last clip on the stack.

public void
popTransformLayer()

Redeclares com.openhtmltopdf.extend.OutputDevice.popTransformLayer.

Reverts the transform on the stack.

public void
public void
pushClip(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushClip.

Applies a clip on the output device.

public void
pushTransformLayer(AffineTransform transform)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushTransformLayer.

Applies a transform on the output device.

public List<AffineTransform>
pushTransforms(List<AffineTransform> transforms)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushTransforms.

Apply the given transform on top of the current one in the PDF graphics stream.

public void
public void
public void
public void
public void
public void
setMetadata(String
the metadata element name to locate.
name
,
String value)

Replaces all copies of the named metadata with a single value.

public void
public void
public void
public void
setRoot(Box root)

public void
public void
setStartPageNo(int startPageNo)

public void
public void
public void
public void
Inherited from com.openhtmltopdf.extend.OutputDevice:
drawDebugOutlinedrawLinearGradientdrawTextdrawTextDecorationdrawTextDecorationendStructurepaintBackgroundpaintBorderpaintBorderpaintCollapsedBorderstartStructure

Method Detail

addMetadataback to summary
public void addMetadata(String name, String value)

Appends a name/content metadata pair to this output device. A name or content value of null will be ignored.

Parameters
name:String

the name of the metadata element to add.

clipback to summary
public void clip(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.clip.

closeback to summary
public void close()

Perform any internal cleanup needed

drawback to summary
public void draw(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.draw.

drawBorderLineback to summary
public void drawBorderLine(Shape bounds, int side, int lineWidth, boolean solid)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawBorderLine.

drawImageback to summary
public void drawImage(FSImage fsImage, int x, int y, boolean interpolate)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawImage.

drawOvalback to summary
public void drawOval(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawOval.

drawPdfAsImageback to summary
public void drawPdfAsImage(PDFormXObject _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)
drawRectback to summary
public void drawRect(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawRect.

drawSelectionback to summary
public void drawSelection(RenderingContext c, InlineText inlineText)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawSelection.

drawStringback to summary
public void drawString(String s, float x, float y, JustificationInfo info)
drawStringFastback to summary
public void drawStringFast(String s, float x, float y, JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize)
drawWithGraphicsback to summary
public void drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)

Redeclares com.openhtmltopdf.extend.OutputDevice.drawWithGraphics.

Doc from com.openhtmltopdf.extend.OutputDevice.drawWithGraphics.

Draw something using a Graphics2D at the given rectangle.

fillback to summary
public void fill(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.fill.

fillOvalback to summary
public void fillOval(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.fillOval.

fillRectback to summary
public void fillRect(int x, int y, int width, int height)

Redeclares com.openhtmltopdf.extend.OutputDevice.fillRect.

findPagePositionsByIDback to summary
public List<PagePosition<Box>> findPagePositionsByID(CssContext c, Pattern pattern)
finishback to summary
public void finish(RenderingContext c, Box root)
finishPageback to summary
public void finishPage()
getAbsoluteTransformOriginXback to summary
public float getAbsoluteTransformOriginX()

Redeclares com.openhtmltopdf.extend.OutputDevice.getAbsoluteTransformOriginX.

getAbsoluteTransformOriginYback to summary
public float getAbsoluteTransformOriginY()

Redeclares com.openhtmltopdf.extend.OutputDevice.getAbsoluteTransformOriginY.

getClipback to summary
public Shape getClip()

Redeclares com.openhtmltopdf.extend.OutputDevice.getClip.

getCurrentPageback to summary
public PdfContentStreamAdapter getCurrentPage()
getDeviceLengthback to summary
public float getDeviceLength(float length)

Given a value in dots units, converts to PDF points.

getDotsPerPointback to summary
public float getDotsPerPoint()
getMetadataback to summary
public List<PdfBoxSlowOutputDevice.Metadata> getMetadata()
getMetadataByNameback to summary
public String getMetadataByName(String name)

Searches the metadata name/content pairs of the current document and returns the content value from the first pair with a matching name. The search is case insensitive.

Parameters
name:String

the metadata element name to locate.

Returns:String

the content value of the first found metadata element; otherwise null.

getMetadataListByNameback to summary
public List<String> getMetadataListByName(String name)

Searches the metadata name/content pairs of the current document and returns any content values with a matching name in an ArrayList. The search is case insensitive.

Parameters
name:String

the metadata element name to locate.

Returns:List<String>

an ArrayList with matching content values; otherwise an empty list.

getPageback to summary
public PDPage getPage()
getPageRefYback to summary
public int getPageRefY(Box box)
getRenderingHintback to summary
public Object getRenderingHint(RenderingHints.Key key)

Redeclares com.openhtmltopdf.extend.OutputDevice.getRenderingHint.

getSharedContextback to summary
public SharedContext getSharedContext()
getStartPageNoback to summary
public int getStartPageNo()
getStrokeback to summary
public Stroke getStroke()

Redeclares com.openhtmltopdf.extend.OutputDevice.getStroke.

getWriterback to summary
public PDDocument getWriter()
initializePageback to summary
public void initializePage(PDPageContentStream currentPage, PDPage page, float height)

Start a page. A new PDF page starts a new content stream so all graphics state has to be set back to default.

isFastRendererback to summary
public boolean isFastRenderer()

Redeclares com.openhtmltopdf.extend.OutputDevice.isFastRenderer.

Doc from com.openhtmltopdf.extend.OutputDevice.isFastRenderer.

The new (2018) fast renderer is in use.

isPDFback to summary
public boolean isPDF()

Redeclares com.openhtmltopdf.extend.OutputDevice.isPDF.

isSupportsCMYKColorsback to summary
public boolean isSupportsCMYKColors()

Redeclares com.openhtmltopdf.extend.OutputDevice.isSupportsCMYKColors.

isSupportsSelectionback to summary
public boolean isSupportsSelection()

Redeclares com.openhtmltopdf.extend.OutputDevice.isSupportsSelection.

normalizeYback to summary
public float normalizeY(float y, float pageHeight)

Converts a top down unit to a bottom up PDF unit for the specified page height.

paintBackgroundback to summary
public void paintBackground(RenderingContext c, Box box)

Redeclares com.openhtmltopdf.extend.OutputDevice.paintBackground.

We use paintBackground to do extra stuff such as processing links, forms and form controls.

paintReplacedElementback to summary
public void paintReplacedElement(RenderingContext c, BlockBox box)

Redeclares com.openhtmltopdf.extend.OutputDevice.paintReplacedElement.

popClipback to summary
public void popClip()

Redeclares com.openhtmltopdf.extend.OutputDevice.popClip.

Doc from com.openhtmltopdf.extend.OutputDevice.popClip.

Reverts the last clip on the stack. The fast renderer MUST use pushClip and popClip in preference to clip and setClip.

Note

The current implementation shares a stack between transforms and clips, so calls to pushTransformLayer(AffineTransform), popTransformLayer(), pushClip(Shape) and popClip() MUST be nested correctly.

popTransformLayerback to summary
public void popTransformLayer()

Redeclares com.openhtmltopdf.extend.OutputDevice.popTransformLayer.

Doc from com.openhtmltopdf.extend.OutputDevice.popTransformLayer.

Reverts the transform on the stack.

Note

The current implementation shares a stack between transforms and clips, so calls to pushTransformLayer(AffineTransform), popTransformLayer(), pushClip(Shape) and popClip() MUST be nested correctly.

popTransformsback to summary
public void popTransforms(List<AffineTransform> inverse)

Redeclares com.openhtmltopdf.extend.OutputDevice.popTransforms.

pushClipback to summary
public void pushClip(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushClip.

Doc from com.openhtmltopdf.extend.OutputDevice.pushClip.

Applies a clip on the output device. This is a cumulative operation. The fast renderer MUST use pushClip and popClip in preference to clip and setClip.

Note

The current implementation shares a stack between transforms and clips, so calls to pushTransformLayer(AffineTransform), popTransformLayer(), pushClip(Shape) and popClip() MUST be nested correctly.

pushTransformLayerback to summary
public void pushTransformLayer(AffineTransform transform)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushTransformLayer.

Doc from com.openhtmltopdf.extend.OutputDevice.pushTransformLayer.

Applies a transform on the output device. This is a cumulativew operation.

Note

The current implementation shares a stack between transforms and clips, so calls to pushTransformLayer(AffineTransform), popTransformLayer(), pushClip(Shape) and popClip() MUST be nested correctly.

pushTransformsback to summary
public List<AffineTransform> pushTransforms(List<AffineTransform> transforms)

Redeclares com.openhtmltopdf.extend.OutputDevice.pushTransforms.

Doc from com.openhtmltopdf.extend.OutputDevice.pushTransforms.

Apply the given transform on top of the current one in the PDF graphics stream. This is a cumulative operation. You should popTransform after the box and children are painted.

Returns:List<AffineTransform>

the list of inverse transforms to undo the effect of this transform

realizeImageback to summary
public void realizeImage(PdfBoxImage img)
setBidiReordererback to summary
public void setBidiReorderer(BidiReorderer reorderer)
setClipback to summary
public void setClip(Shape s)

Redeclares com.openhtmltopdf.extend.OutputDevice.setClip.

setColorback to summary
public void setColor(FSColor color)

Redeclares com.openhtmltopdf.extend.OutputDevice.setColor.

setFontback to summary
public void setFont(FSFont font)

Redeclares com.openhtmltopdf.extend.OutputDevice.setFont.

setMetadataback to summary
public void setMetadata(String name, String value)

Replaces all copies of the named metadata with a single value. A a new value of null will result in the removal of all copies of the named metadata. Use addMetadata to append additional values with the same name.

Parameters
name:String

the metadata element name to locate.

setPaintback to summary
public void setPaint(Paint paint)

Redeclares com.openhtmltopdf.extend.OutputDevice.setPaint.

setRenderingContextback to summary
public void setRenderingContext(RenderingContext result)
setRenderingHintback to summary
public void setRenderingHint(RenderingHints.Key key, Object value)

Redeclares com.openhtmltopdf.extend.OutputDevice.setRenderingHint.

setRootback to summary
public void setRoot(Box root)
setSharedContextback to summary
public void setSharedContext(SharedContext sharedContext)
setStartPageNoback to summary
public void setStartPageNo(int startPageNo)
setStrokeback to summary
public void setStroke(Stroke s)

Redeclares com.openhtmltopdf.extend.OutputDevice.setStroke.

setWriterback to summary
public void setWriter(PDDocument writer)
startback to summary
public void start(Document doc)
translateback to summary
public void translate(double tx, double ty)

Redeclares com.openhtmltopdf.extend.OutputDevice.translate.