Package com.openhtmltopdf.pdfboxout
Class PdfBoxFastOutputDevice
java.lang.Object
com.openhtmltopdf.render.AbstractOutputDevice
com.openhtmltopdf.pdfboxout.PdfBoxFastOutputDevice
- All Implemented Interfaces:
com.openhtmltopdf.extend.OutputDevice,PdfBoxOutputDevice
public class PdfBoxFastOutputDevice extends com.openhtmltopdf.render.AbstractOutputDevice implements com.openhtmltopdf.extend.OutputDevice, PdfBoxOutputDevice
-
Constructor Summary
Constructors Constructor Description PdfBoxFastOutputDevice(float dotsPerPoint, boolean testMode, boolean pdfUaConform, boolean pdfAConform) -
Method Summary
Modifier and Type Method Description voidaddMetadata(String name, String value)Appends a name/content metadata pair to this output device.voidclip(Shape s)voidclose()Perform any internal cleanup neededvoiddraw(Shape s)voiddrawBorderLine(Shape bounds, int side, int lineWidth, boolean solid)voiddrawImage(com.openhtmltopdf.extend.FSImage fsImage, int x, int y, boolean interpolate)protected voiddrawLine(int x1, int y1, int x2, int y2)voiddrawLinearGradient(com.openhtmltopdf.css.style.derived.FSLinearGradient backgroundLinearGradient, Shape bounds)voiddrawOval(int x, int y, int width, int height)voiddrawPdfAsImage(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject _srcObject, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)voiddrawRect(int x, int y, int width, int height)voiddrawSelection(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.InlineText inlineText)voiddrawString(String s, float x, float y, com.openhtmltopdf.render.JustificationInfo info)voiddrawStringFast(String s, float x, float y, com.openhtmltopdf.render.JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize)voiddrawWithGraphics(float x, float y, float width, float height, com.openhtmltopdf.extend.OutputDeviceGraphicsDrawer renderer)voidendStructure(Object token)voidfill(Shape s)voidfillOval(int x, int y, int width, int height)voidfillRect(int x, int y, int width, int height)List<PagePosition>findPagePositionsByID(com.openhtmltopdf.css.style.CssContext c, Pattern pattern)voidfinish(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.Box root)voidfinishPage()floatgetAbsoluteTransformOriginX()floatgetAbsoluteTransformOriginY()ShapegetClip()PdfContentStreamAdaptergetCurrentPage()floatgetDeviceLength(float length)Given a value in dots units, converts to PDF points.floatgetDotsPerPoint()List<com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice.Metadata>getMetadata()StringgetMetadataByName(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.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.org.apache.pdfbox.pdmodel.PDPagegetPage()intgetPageRefY(com.openhtmltopdf.render.Box box)ObjectgetRenderingHint(RenderingHints.Key key)com.openhtmltopdf.layout.SharedContextgetSharedContext()intgetStartPageNo()StrokegetStroke()org.apache.pdfbox.pdmodel.PDDocumentgetWriter()voidinitializePage(org.apache.pdfbox.pdmodel.PDPageContentStream currentPage, org.apache.pdfbox.pdmodel.PDPage page, float height)Start a page.booleanisFastRenderer()booleanisPDF()booleanisSupportsCMYKColors()booleanisSupportsSelection()floatnormalizeY(float y)Converts a top down unit to a bottom up PDF unit for the current page.floatnormalizeY(float y, float pageHeight)Converts a top down unit to a bottom up PDF unit for the specified page height.voidpaintBackground(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.Box box)We use paintBackground to do extra stuff such as processing links, forms and form controls.voidpaintReplacedElement(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.BlockBox box)voidpopClip()voidpopTransformLayer()voidpopTransforms(List<AffineTransform> inverse)voidpushClip(Shape s)voidpushTransformLayer(AffineTransform transform)List<AffineTransform>pushTransforms(List<AffineTransform> transforms)voidrealizeImage(PdfBoxImage img)voidsetBidiReorderer(com.openhtmltopdf.bidi.BidiReorderer reorderer)voidsetClip(Shape s)voidsetColor(com.openhtmltopdf.css.parser.FSColor color)voidsetFont(com.openhtmltopdf.render.FSFont font)voidsetMetadata(String name, String value)Replaces all copies of the named metadata with a single value.voidsetPaint(Paint paint)voidsetRenderingContext(com.openhtmltopdf.render.RenderingContext result)voidsetRenderingHint(RenderingHints.Key key, Object value)voidsetRoot(com.openhtmltopdf.render.Box root)voidsetSharedContext(com.openhtmltopdf.layout.SharedContext sharedContext)voidsetStartPageNo(int startPageNo)voidsetStroke(Stroke s)voidsetWriter(org.apache.pdfbox.pdmodel.PDDocument writer)voidstart(Document doc)ObjectstartStructure(com.openhtmltopdf.extend.StructureType type, com.openhtmltopdf.render.Box box)voidtranslate(double tx, double ty)Methods inherited from class com.openhtmltopdf.render.AbstractOutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, getFontSpecification, paintBackground, paintBorder, paintBorder, paintCollapsedBorder, setFontSpecificationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.openhtmltopdf.extend.OutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, paintBackground, paintBorder, paintBorder, paintCollapsedBorder
-
Constructor Details
-
PdfBoxFastOutputDevice
public PdfBoxFastOutputDevice(float dotsPerPoint, boolean testMode, boolean pdfUaConform, boolean pdfAConform)
-
-
Method Details
-
setWriter
public void setWriter(org.apache.pdfbox.pdmodel.PDDocument writer)- Specified by:
setWriterin interfacePdfBoxOutputDevice
-
getWriter
public org.apache.pdfbox.pdmodel.PDDocument getWriter()- Specified by:
getWriterin interfacePdfBoxOutputDevice
-
initializePage
public 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.- Specified by:
initializePagein interfacePdfBoxOutputDevice
-
finishPage
public void finishPage()- Specified by:
finishPagein interfacePdfBoxOutputDevice
-
paintReplacedElement
public void paintReplacedElement(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.BlockBox box)- Specified by:
paintReplacedElementin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
paintReplacedElementin interfacePdfBoxOutputDevice
-
paintBackground
public void paintBackground(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.Box box)We use paintBackground to do extra stuff such as processing links, forms and form controls.- Specified by:
paintBackgroundin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
paintBackgroundin interfacePdfBoxOutputDevice- Overrides:
paintBackgroundin classcom.openhtmltopdf.render.AbstractOutputDevice
-
getDeviceLength
public float getDeviceLength(float length)Given a value in dots units, converts to PDF points.- Specified by:
getDeviceLengthin interfacePdfBoxOutputDevice
-
drawBorderLine
- Specified by:
drawBorderLinein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawBorderLinein interfacePdfBoxOutputDevice
-
setColor
public void setColor(com.openhtmltopdf.css.parser.FSColor color)- Specified by:
setColorin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setColorin interfacePdfBoxOutputDevice
-
draw
- Specified by:
drawin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawin interfacePdfBoxOutputDevice
-
drawLine
protected void drawLine(int x1, int y1, int x2, int y2)- Specified by:
drawLinein classcom.openhtmltopdf.render.AbstractOutputDevice
-
drawRect
public void drawRect(int x, int y, int width, int height)- Specified by:
drawRectin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawRectin interfacePdfBoxOutputDevice
-
drawOval
public void drawOval(int x, int y, int width, int height)- Specified by:
drawOvalin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawOvalin interfacePdfBoxOutputDevice
-
fill
- Specified by:
fillin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
fillin interfacePdfBoxOutputDevice
-
fillRect
public void fillRect(int x, int y, int width, int height)- Specified by:
fillRectin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
fillRectin interfacePdfBoxOutputDevice
-
fillOval
public void fillOval(int x, int y, int width, int height)- Specified by:
fillOvalin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
fillOvalin interfacePdfBoxOutputDevice
-
translate
public void translate(double tx, double ty)- Specified by:
translatein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
translatein interfacePdfBoxOutputDevice
-
getRenderingHint
- Specified by:
getRenderingHintin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getRenderingHintin interfacePdfBoxOutputDevice
-
setRenderingHint
- Specified by:
setRenderingHintin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setRenderingHintin interfacePdfBoxOutputDevice
-
setFont
public void setFont(com.openhtmltopdf.render.FSFont font)- Specified by:
setFontin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setFontin interfacePdfBoxOutputDevice
-
drawString
public void drawString(String s, float x, float y, com.openhtmltopdf.render.JustificationInfo info)- Specified by:
drawStringin interfacePdfBoxOutputDevice
-
drawStringFast
public void drawStringFast(String s, float x, float y, com.openhtmltopdf.render.JustificationInfo info, PdfBoxFontResolver.FontDescription desc, float fontSize)- Specified by:
drawStringFastin interfacePdfBoxOutputDevice
-
getCurrentPage
- Specified by:
getCurrentPagein interfacePdfBoxOutputDevice
-
getPage
public org.apache.pdfbox.pdmodel.PDPage getPage()- Specified by:
getPagein interfacePdfBoxOutputDevice
-
normalizeY
public float normalizeY(float y)Converts a top down unit to a bottom up PDF unit for the current page. -
normalizeY
public float normalizeY(float y, float pageHeight)Converts a top down unit to a bottom up PDF unit for the specified page height.- Specified by:
normalizeYin interfacePdfBoxOutputDevice
-
setStroke
- Specified by:
setStrokein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setStrokein interfacePdfBoxOutputDevice
-
clip
- Specified by:
clipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
clipin interfacePdfBoxOutputDevice
-
getClip
- Specified by:
getClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getClipin interfacePdfBoxOutputDevice
-
popClip
public void popClip()- Specified by:
popClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
popClipin interfacePdfBoxOutputDevice
-
pushClip
- Specified by:
pushClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
pushClipin interfacePdfBoxOutputDevice
-
setClip
- Specified by:
setClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setClipin interfacePdfBoxOutputDevice
-
getStroke
- Specified by:
getStrokein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getStrokein interfacePdfBoxOutputDevice
-
realizeImage
- Specified by:
realizeImagein interfacePdfBoxOutputDevice
-
drawLinearGradient
public void drawLinearGradient(com.openhtmltopdf.css.style.derived.FSLinearGradient backgroundLinearGradient, Shape bounds)- Specified by:
drawLinearGradientin interfacecom.openhtmltopdf.extend.OutputDevice
-
drawImage
public void drawImage(com.openhtmltopdf.extend.FSImage fsImage, int x, int y, boolean interpolate)- Specified by:
drawImagein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawImagein interfacePdfBoxOutputDevice
-
drawPdfAsImage
public void drawPdfAsImage(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject _srcObject, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)- Specified by:
drawPdfAsImagein interfacePdfBoxOutputDevice
-
getDotsPerPoint
public float getDotsPerPoint()- Specified by:
getDotsPerPointin interfacePdfBoxOutputDevice
-
start
- Specified by:
startin interfacePdfBoxOutputDevice
-
finish
public void finish(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.Box root)- Specified by:
finishin interfacePdfBoxOutputDevice
-
getPageRefY
public int getPageRefY(com.openhtmltopdf.render.Box box)- Specified by:
getPageRefYin interfacePdfBoxOutputDevice
-
addMetadata
Appends a name/content metadata pair to this output device. A name or content value of null will be ignored.- Specified by:
addMetadatain interfacePdfBoxOutputDevice- 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.- Specified by:
getMetadataByNamein interfacePdfBoxOutputDevice- 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.- Specified by:
getMetadataListByNamein interfacePdfBoxOutputDevice- 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.- Specified by:
setMetadatain interfacePdfBoxOutputDevice- Parameters:
name- the metadata element name to locate.
-
getMetadata
- Specified by:
getMetadatain interfacePdfBoxOutputDevice- Returns:
- All metadata entries
-
setRoot
public void setRoot(com.openhtmltopdf.render.Box root)- Specified by:
setRootin interfacePdfBoxOutputDevice
-
getStartPageNo
public int getStartPageNo()- Specified by:
getStartPageNoin interfacePdfBoxOutputDevice
-
setStartPageNo
public void setStartPageNo(int startPageNo)- Specified by:
setStartPageNoin interfacePdfBoxOutputDevice
-
drawSelection
public void drawSelection(com.openhtmltopdf.render.RenderingContext c, com.openhtmltopdf.render.InlineText inlineText)- Specified by:
drawSelectionin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawSelectionin interfacePdfBoxOutputDevice
-
isSupportsSelection
public boolean isSupportsSelection()- Specified by:
isSupportsSelectionin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
isSupportsSelectionin interfacePdfBoxOutputDevice
-
isSupportsCMYKColors
public boolean isSupportsCMYKColors()- Specified by:
isSupportsCMYKColorsin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
isSupportsCMYKColorsin interfacePdfBoxOutputDevice
-
drawWithGraphics
public void drawWithGraphics(float x, float y, float width, float height, com.openhtmltopdf.extend.OutputDeviceGraphicsDrawer renderer)- Specified by:
drawWithGraphicsin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
drawWithGraphicsin interfacePdfBoxOutputDevice
-
findPagePositionsByID
public List<PagePosition> findPagePositionsByID(com.openhtmltopdf.css.style.CssContext c, Pattern pattern)- Specified by:
findPagePositionsByIDin interfacePdfBoxOutputDevice
-
setRenderingContext
public void setRenderingContext(com.openhtmltopdf.render.RenderingContext result)- Specified by:
setRenderingContextin interfacePdfBoxOutputDevice
-
setBidiReorderer
public void setBidiReorderer(com.openhtmltopdf.bidi.BidiReorderer reorderer)- Specified by:
setBidiReordererin interfacePdfBoxOutputDevice
-
popTransforms
- Specified by:
popTransformsin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
popTransformsin interfacePdfBoxOutputDevice
-
pushTransforms
- Specified by:
pushTransformsin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
pushTransformsin interfacePdfBoxOutputDevice
-
getAbsoluteTransformOriginX
public float getAbsoluteTransformOriginX()- Specified by:
getAbsoluteTransformOriginXin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getAbsoluteTransformOriginXin interfacePdfBoxOutputDevice
-
getAbsoluteTransformOriginY
public float getAbsoluteTransformOriginY()- Specified by:
getAbsoluteTransformOriginYin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getAbsoluteTransformOriginYin interfacePdfBoxOutputDevice
-
setPaint
- Specified by:
setPaintin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setPaintin interfacePdfBoxOutputDevice
-
isPDF
public boolean isPDF()- Specified by:
isPDFin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
isPDFin interfacePdfBoxOutputDevice- Overrides:
isPDFin classcom.openhtmltopdf.render.AbstractOutputDevice
-
close
public void close()Perform any internal cleanup needed- Specified by:
closein interfacePdfBoxOutputDevice
-
pushTransformLayer
- Specified by:
pushTransformLayerin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
pushTransformLayerin interfacePdfBoxOutputDevice
-
popTransformLayer
public void popTransformLayer()- Specified by:
popTransformLayerin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
popTransformLayerin interfacePdfBoxOutputDevice
-
isFastRenderer
public boolean isFastRenderer()- Specified by:
isFastRendererin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
isFastRendererin interfacePdfBoxOutputDevice
-
startStructure
public Object startStructure(com.openhtmltopdf.extend.StructureType type, com.openhtmltopdf.render.Box box)- Specified by:
startStructurein interfacecom.openhtmltopdf.extend.OutputDevice
-
endStructure
- Specified by:
endStructurein interfacecom.openhtmltopdf.extend.OutputDevice
-