Package com.openhtmltopdf.pdfboxout
Interface PdfBoxOutputDevice
- All Superinterfaces:
OutputDevice
- All Known Implementing Classes:
PdfBoxFastOutputDevice,PdfBoxSlowOutputDevice
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadata(String name, String value) Appends a name/content metadata pair to this output device.voidvoidclose()Perform any internal cleanup neededvoidvoiddrawBorderLine(Shape bounds, int side, int lineWidth, boolean solid) voidvoiddrawOval(int x, int y, int width, int height) voiddrawPdfAsImage(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight) voiddrawRect(int x, int y, int width, int height) voiddrawSelection(RenderingContext c, InlineText inlineText) voiddrawString(String s, float x, float y, JustificationInfo info) voiddrawStringFast(String s, float x, float y, JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize) voiddrawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer) Draw something using a Graphics2D at the given rectangle.voidvoidfillOval(int x, int y, int width, int height) voidfillRect(int x, int y, int width, int height) findPagePositionsByID(CssContext c, Pattern pattern) voidfinish(RenderingContext c, Box root) voidfloatfloatgetClip()floatgetDeviceLength(float length) Given a value in dots units, converts to PDF points.floatgetMetadataByName(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.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.org.apache.pdfbox.pdmodel.PDPagegetPage()intgetPageRefY(Box box) intorg.apache.pdfbox.pdmodel.PDDocumentvoidinitializePage(org.apache.pdfbox.pdmodel.PDPageContentStream currentPage, org.apache.pdfbox.pdmodel.PDPage page, float height) Start a page.booleanThe new (2018) fast renderer is in use.booleanisPDF()booleanbooleanfloatnormalizeY(float y, float pageHeight) Converts a top down unit to a bottom up PDF unit for the specified page height.voidpaintBackground(RenderingContext c, Box box) We use paintBackground to do extra stuff such as processing links, forms and form controls.voidvoidpopClip()Reverts the last clip on the stack.voidReverts the transform on the stack.voidpopTransforms(List<AffineTransform> inverse) voidApplies a clip on the output device.voidpushTransformLayer(AffineTransform transform) Applies a transform on the output device.pushTransforms(List<AffineTransform> transforms) Apply the given transform on top of the current one in the PDF graphics stream.voidrealizeImage(PdfBoxImage img) voidsetBidiReorderer(BidiReorderer reorderer) voidvoidvoidvoidsetMetadata(String name, String value) Replaces all copies of the named metadata with a single value.voidvoidsetRenderingContext(RenderingContext result) voidsetRenderingHint(RenderingHints.Key key, Object value) voidvoidsetSharedContext(SharedContext sharedContext) voidsetStartPageNo(int startPageNo) voidvoidsetWriter(org.apache.pdfbox.pdmodel.PDDocument writer) voidvoidtranslate(double tx, double ty) Methods inherited from interface com.openhtmltopdf.extend.OutputDevice
drawDebugOutline, drawLinearGradient, drawText, drawTextDecoration, drawTextDecoration, endStructure, paintBackground, paintBorder, paintBorder, paintCollapsedBorder, startStructure
-
Method Details
-
setWriter
void setWriter(org.apache.pdfbox.pdmodel.PDDocument writer) -
getWriter
org.apache.pdfbox.pdmodel.PDDocument getWriter() -
initializePage
void initializePage(org.apache.pdfbox.pdmodel.PDPageContentStream currentPage, org.apache.pdfbox.pdmodel.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. -
finishPage
void finishPage() -
paintReplacedElement
- Specified by:
paintReplacedElementin interfaceOutputDevice
-
paintBackground
We use paintBackground to do extra stuff such as processing links, forms and form controls.- Specified by:
paintBackgroundin interfaceOutputDevice
-
getDeviceLength
float getDeviceLength(float length) Given a value in dots units, converts to PDF points. -
drawBorderLine
- Specified by:
drawBorderLinein interfaceOutputDevice
-
setColor
- Specified by:
setColorin interfaceOutputDevice
-
draw
- Specified by:
drawin interfaceOutputDevice
-
drawRect
void drawRect(int x, int y, int width, int height) - Specified by:
drawRectin interfaceOutputDevice
-
drawOval
void drawOval(int x, int y, int width, int height) - Specified by:
drawOvalin interfaceOutputDevice
-
fill
- Specified by:
fillin interfaceOutputDevice
-
fillRect
void fillRect(int x, int y, int width, int height) - Specified by:
fillRectin interfaceOutputDevice
-
fillOval
void fillOval(int x, int y, int width, int height) - Specified by:
fillOvalin interfaceOutputDevice
-
translate
void translate(double tx, double ty) - Specified by:
translatein interfaceOutputDevice
-
getRenderingHint
- Specified by:
getRenderingHintin interfaceOutputDevice
-
setRenderingHint
- Specified by:
setRenderingHintin interfaceOutputDevice
-
setFont
- Specified by:
setFontin interfaceOutputDevice
-
drawString
-
drawStringFast
void drawStringFast(String s, float x, float y, JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize) -
getCurrentPage
PdfContentStreamAdapter getCurrentPage() -
getPage
org.apache.pdfbox.pdmodel.PDPage getPage() -
normalizeY
float normalizeY(float y, float pageHeight) Converts a top down unit to a bottom up PDF unit for the specified page height. -
setStroke
- Specified by:
setStrokein interfaceOutputDevice
-
clip
- Specified by:
clipin interfaceOutputDevice
-
getClip
Shape getClip()- Specified by:
getClipin interfaceOutputDevice
-
popClip
void popClip()Description copied from interface:OutputDeviceReverts the last clip on the stack. The fast renderer MUST usepushClipandpopClipin preference toclipandsetClip. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform),OutputDevice.popTransformLayer(),OutputDevice.pushClip(Shape)andOutputDevice.popClip()MUST be nested correctly.- Specified by:
popClipin interfaceOutputDevice
-
pushClip
Description copied from interface:OutputDeviceApplies a clip on the output device. This is a cumulative operation. The fast renderer MUST usepushClipandpopClipin preference toclipandsetClip. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform),OutputDevice.popTransformLayer(),OutputDevice.pushClip(Shape)andOutputDevice.popClip()MUST be nested correctly.- Specified by:
pushClipin interfaceOutputDevice
-
setClip
- Specified by:
setClipin interfaceOutputDevice
-
getStroke
Stroke getStroke()- Specified by:
getStrokein interfaceOutputDevice
-
realizeImage
-
drawImage
- Specified by:
drawImagein interfaceOutputDevice
-
getDotsPerPoint
float getDotsPerPoint() -
start
-
finish
-
addMetadata
Appends a name/content metadata pair to this output device. A name or content value of null will be ignored.- Parameters:
name- the name of the metadata element to add.
-
getMetadataByName
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- the metadata element name to locate.- Returns:
- the content value of the first found metadata element; otherwise null.
-
getMetadataListByName
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- the metadata element name to locate.- Returns:
- an ArrayList with matching content values; otherwise an empty list.
-
setMetadata
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. UseaddMetadatato append additional values with the same name.- Parameters:
name- the metadata element name to locate.
-
setRoot
-
getStartPageNo
int getStartPageNo() -
setStartPageNo
void setStartPageNo(int startPageNo) -
drawSelection
- Specified by:
drawSelectionin interfaceOutputDevice
-
isSupportsSelection
boolean isSupportsSelection()- Specified by:
isSupportsSelectionin interfaceOutputDevice
-
isSupportsCMYKColors
boolean isSupportsCMYKColors()- Specified by:
isSupportsCMYKColorsin interfaceOutputDevice
-
drawWithGraphics
void drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer) Description copied from interface:OutputDeviceDraw something using a Graphics2D at the given rectangle.- Specified by:
drawWithGraphicsin interfaceOutputDevice
-
findPagePositionsByID
-
setRenderingContext
-
setBidiReorderer
-
popTransforms
- Specified by:
popTransformsin interfaceOutputDevice
-
pushTransforms
Description copied from interface:OutputDeviceApply 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.- Specified by:
pushTransformsin interfaceOutputDevice- Returns:
- the list of inverse transforms to undo the effect of this transform
-
getAbsoluteTransformOriginX
float getAbsoluteTransformOriginX()- Specified by:
getAbsoluteTransformOriginXin interfaceOutputDevice
-
getAbsoluteTransformOriginY
float getAbsoluteTransformOriginY()- Specified by:
getAbsoluteTransformOriginYin interfaceOutputDevice
-
setPaint
- Specified by:
setPaintin interfaceOutputDevice
-
isPDF
boolean isPDF()- Specified by:
isPDFin interfaceOutputDevice
-
close
void close()Perform any internal cleanup needed -
pushTransformLayer
Description copied from interface:OutputDeviceApplies a transform on the output device. This is a cumulativew operation. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform),OutputDevice.popTransformLayer(),OutputDevice.pushClip(Shape)andOutputDevice.popClip()MUST be nested correctly.- Specified by:
pushTransformLayerin interfaceOutputDevice
-
popTransformLayer
void popTransformLayer()Description copied from interface:OutputDeviceReverts the transform on the stack. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform),OutputDevice.popTransformLayer(),OutputDevice.pushClip(Shape)andOutputDevice.popClip()MUST be nested correctly.- Specified by:
popTransformLayerin interfaceOutputDevice
-
isFastRenderer
boolean isFastRenderer()Description copied from interface:OutputDeviceThe new (2018) fast renderer is in use.- Specified by:
isFastRendererin interfaceOutputDevice
-
getPageRefY
-
getMetadata
List<PdfBoxSlowOutputDevice.Metadata> getMetadata() -
drawPdfAsImage
void drawPdfAsImage(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)
-