Package com.openhtmltopdf.pdfboxout
Class PdfBoxSlowOutputDevice
- java.lang.Object
-
- com.openhtmltopdf.render.AbstractOutputDevice
-
- com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice
-
- All Implemented Interfaces:
com.openhtmltopdf.extend.OutputDevice,PdfBoxOutputDevice
public class PdfBoxSlowOutputDevice extends com.openhtmltopdf.render.AbstractOutputDevice implements com.openhtmltopdf.extend.OutputDevice, PdfBoxOutputDevice
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPdfBoxSlowOutputDevice.FontRun
-
Constructor Summary
Constructors Constructor Description PdfBoxSlowOutputDevice(float dotsPerPoint, boolean testMode)
-
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)voiddrawOval(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(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, 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, setFontSpecification
-
-
-
-
Method Detail
-
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
public void drawBorderLine(Shape bounds, int side, int lineWidth, boolean solid)
- 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
public void draw(Shape s)
- 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
public void fill(Shape s)
- 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
public Object getRenderingHint(RenderingHints.Key key)
- Specified by:
getRenderingHintin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getRenderingHintin interfacePdfBoxOutputDevice
-
setRenderingHint
public void setRenderingHint(RenderingHints.Key key, Object value)
- 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
public PdfContentStreamAdapter getCurrentPage()
- Specified by:
getCurrentPagein interfacePdfBoxOutputDevice
-
getPage
public org.apache.pdfbox.pdmodel.PDPage getPage()
- Specified by:
getPagein interfacePdfBoxOutputDevice
-
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
public void setStroke(Stroke s)
- Specified by:
setStrokein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setStrokein interfacePdfBoxOutputDevice
-
clip
public void clip(Shape s)
- Specified by:
clipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
clipin interfacePdfBoxOutputDevice
-
getClip
public Shape 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
public void pushClip(Shape s)
- Specified by:
pushClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
pushClipin interfacePdfBoxOutputDevice
-
setClip
public void setClip(Shape s)
- Specified by:
setClipin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
setClipin interfacePdfBoxOutputDevice
-
getStroke
public Stroke getStroke()
- Specified by:
getStrokein interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
getStrokein interfacePdfBoxOutputDevice
-
realizeImage
public void realizeImage(PdfBoxImage img)
- Specified by:
realizeImagein interfacePdfBoxOutputDevice
-
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 _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)- Specified by:
drawPdfAsImagein interfacePdfBoxOutputDevice
-
getDotsPerPoint
public float getDotsPerPoint()
- Specified by:
getDotsPerPointin interfacePdfBoxOutputDevice
-
start
public void start(Document doc)
- 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
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.- Specified by:
addMetadatain interfacePdfBoxOutputDevice- Parameters:
name- the name of the metadata element to add.
-
getMetadataByName
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.- 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
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.- Specified by:
getMetadataListByNamein interfacePdfBoxOutputDevice- Parameters:
name- the metadata element name to locate.- Returns:
- an ArrayList with matching content values; otherwise an empty list.
-
setMetadata
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. UseaddMetadatato append additional values with the same name.- Specified by:
setMetadatain interfacePdfBoxOutputDevice- Parameters:
name- the metadata element name to locate.
-
getMetadata
public List<com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice.Metadata> getMetadata()
- Specified by:
getMetadatain interfacePdfBoxOutputDevice- Returns:
- All metadata entries
-
getSharedContext
public com.openhtmltopdf.layout.SharedContext getSharedContext()
- Specified by:
getSharedContextin interfacePdfBoxOutputDevice
-
setSharedContext
public void setSharedContext(com.openhtmltopdf.layout.SharedContext sharedContext)
- Specified by:
setSharedContextin interfacePdfBoxOutputDevice
-
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
public void popTransforms(List<AffineTransform> inverse)
- Specified by:
popTransformsin interfacecom.openhtmltopdf.extend.OutputDevice- Specified by:
popTransformsin interfacePdfBoxOutputDevice
-
pushTransforms
public List<AffineTransform> pushTransforms(List<AffineTransform> transforms)
- 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
public void setPaint(Paint paint)
- 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
public void pushTransformLayer(AffineTransform transform)
- 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
public void endStructure(Object token)
- Specified by:
endStructurein interfacecom.openhtmltopdf.extend.OutputDevice
-
-