Package com.openhtmltopdf.pdfboxout
Class PdfBoxSlowOutputDevice
- java.lang.Object
-
- com.openhtmltopdf.render.AbstractOutputDevice
-
- com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice
-
- All Implemented Interfaces:
OutputDevice,PdfBoxOutputDevice
public class PdfBoxSlowOutputDevice extends AbstractOutputDevice implements 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
All Methods Instance Methods Concrete Methods 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(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(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)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<Box>>findPagePositionsByID(CssContext c, Pattern pattern)voidfinish(RenderingContext c, 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(Box box)ObjectgetRenderingHint(RenderingHints.Key key)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(RenderingContext c, Box box)We use paintBackground to do extra stuff such as processing links, forms and form controls.voidpaintReplacedElement(RenderingContext c, BlockBox box)voidpopClip()voidpopTransformLayer()voidpopTransforms(List<AffineTransform> inverse)voidpushClip(Shape s)voidpushTransformLayer(AffineTransform transform)List<AffineTransform>pushTransforms(List<AffineTransform> transforms)voidrealizeImage(PdfBoxImage img)voidsetBidiReorderer(BidiReorderer reorderer)voidsetClip(Shape s)voidsetColor(FSColor color)voidsetFont(FSFont font)voidsetMetadata(String name, String value)Replaces all copies of the named metadata with a single value.voidsetPaint(Paint paint)voidsetRenderingContext(RenderingContext result)voidsetRenderingHint(RenderingHints.Key key, Object value)voidsetRoot(Box root)voidsetSharedContext(SharedContext sharedContext)voidsetStartPageNo(int startPageNo)voidsetStroke(Stroke s)voidsetWriter(org.apache.pdfbox.pdmodel.PDDocument writer)voidstart(Document doc)ObjectstartStructure(StructureType type, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.openhtmltopdf.extend.OutputDevice
drawDebugOutline, drawLinearGradient, drawText, drawTextDecoration, drawTextDecoration, paintBackground, paintBorder, paintBorder, paintCollapsedBorder
-
-
-
-
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(RenderingContext c, BlockBox box)
- Specified by:
paintReplacedElementin interfaceOutputDevice- Specified by:
paintReplacedElementin interfacePdfBoxOutputDevice
-
paintBackground
public void paintBackground(RenderingContext c, Box box)
We use paintBackground to do extra stuff such as processing links, forms and form controls.- Specified by:
paintBackgroundin interfaceOutputDevice- Specified by:
paintBackgroundin interfacePdfBoxOutputDevice- Overrides:
paintBackgroundin classAbstractOutputDevice
-
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 interfaceOutputDevice- Specified by:
drawBorderLinein interfacePdfBoxOutputDevice
-
setColor
public void setColor(FSColor color)
- Specified by:
setColorin interfaceOutputDevice- Specified by:
setColorin interfacePdfBoxOutputDevice
-
draw
public void draw(Shape s)
- Specified by:
drawin interfaceOutputDevice- Specified by:
drawin interfacePdfBoxOutputDevice
-
drawLine
protected void drawLine(int x1, int y1, int x2, int y2)- Specified by:
drawLinein classAbstractOutputDevice
-
drawRect
public void drawRect(int x, int y, int width, int height)- Specified by:
drawRectin interfaceOutputDevice- Specified by:
drawRectin interfacePdfBoxOutputDevice
-
drawOval
public void drawOval(int x, int y, int width, int height)- Specified by:
drawOvalin interfaceOutputDevice- Specified by:
drawOvalin interfacePdfBoxOutputDevice
-
fill
public void fill(Shape s)
- Specified by:
fillin interfaceOutputDevice- Specified by:
fillin interfacePdfBoxOutputDevice
-
fillRect
public void fillRect(int x, int y, int width, int height)- Specified by:
fillRectin interfaceOutputDevice- Specified by:
fillRectin interfacePdfBoxOutputDevice
-
fillOval
public void fillOval(int x, int y, int width, int height)- Specified by:
fillOvalin interfaceOutputDevice- Specified by:
fillOvalin interfacePdfBoxOutputDevice
-
translate
public void translate(double tx, double ty)- Specified by:
translatein interfaceOutputDevice- Specified by:
translatein interfacePdfBoxOutputDevice
-
getRenderingHint
public Object getRenderingHint(RenderingHints.Key key)
- Specified by:
getRenderingHintin interfaceOutputDevice- Specified by:
getRenderingHintin interfacePdfBoxOutputDevice
-
setRenderingHint
public void setRenderingHint(RenderingHints.Key key, Object value)
- Specified by:
setRenderingHintin interfaceOutputDevice- Specified by:
setRenderingHintin interfacePdfBoxOutputDevice
-
setFont
public void setFont(FSFont font)
- Specified by:
setFontin interfaceOutputDevice- Specified by:
setFontin interfacePdfBoxOutputDevice
-
drawString
public void drawString(String s, float x, float y, JustificationInfo info)
- Specified by:
drawStringin interfacePdfBoxOutputDevice
-
drawStringFast
public void drawStringFast(String s, float x, float y, 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 interfaceOutputDevice- Specified by:
setStrokein interfacePdfBoxOutputDevice
-
clip
public void clip(Shape s)
- Specified by:
clipin interfaceOutputDevice- Specified by:
clipin interfacePdfBoxOutputDevice
-
getClip
public Shape getClip()
- Specified by:
getClipin interfaceOutputDevice- Specified by:
getClipin interfacePdfBoxOutputDevice
-
popClip
public void popClip()
- Specified by:
popClipin interfaceOutputDevice- Specified by:
popClipin interfacePdfBoxOutputDevice
-
pushClip
public void pushClip(Shape s)
- Specified by:
pushClipin interfaceOutputDevice- Specified by:
pushClipin interfacePdfBoxOutputDevice
-
setClip
public void setClip(Shape s)
- Specified by:
setClipin interfaceOutputDevice- Specified by:
setClipin interfacePdfBoxOutputDevice
-
getStroke
public Stroke getStroke()
- Specified by:
getStrokein interfaceOutputDevice- Specified by:
getStrokein interfacePdfBoxOutputDevice
-
realizeImage
public void realizeImage(PdfBoxImage img)
- Specified by:
realizeImagein interfacePdfBoxOutputDevice
-
drawImage
public void drawImage(FSImage fsImage, int x, int y, boolean interpolate)
- Specified by:
drawImagein interfaceOutputDevice- 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(RenderingContext c, Box root)
- Specified by:
finishin interfacePdfBoxOutputDevice
-
getPageRefY
public int getPageRefY(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 SharedContext getSharedContext()
- Specified by:
getSharedContextin interfacePdfBoxOutputDevice
-
setSharedContext
public void setSharedContext(SharedContext sharedContext)
- Specified by:
setSharedContextin interfacePdfBoxOutputDevice
-
setRoot
public void setRoot(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(RenderingContext c, InlineText inlineText)
- Specified by:
drawSelectionin interfaceOutputDevice- Specified by:
drawSelectionin interfacePdfBoxOutputDevice
-
isSupportsSelection
public boolean isSupportsSelection()
- Specified by:
isSupportsSelectionin interfaceOutputDevice- Specified by:
isSupportsSelectionin interfacePdfBoxOutputDevice
-
isSupportsCMYKColors
public boolean isSupportsCMYKColors()
- Specified by:
isSupportsCMYKColorsin interfaceOutputDevice- Specified by:
isSupportsCMYKColorsin interfacePdfBoxOutputDevice
-
drawWithGraphics
public void drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)- Specified by:
drawWithGraphicsin interfaceOutputDevice- Specified by:
drawWithGraphicsin interfacePdfBoxOutputDevice
-
findPagePositionsByID
public List<PagePosition<Box>> findPagePositionsByID(CssContext c, Pattern pattern)
- Specified by:
findPagePositionsByIDin interfacePdfBoxOutputDevice
-
setRenderingContext
public void setRenderingContext(RenderingContext result)
- Specified by:
setRenderingContextin interfacePdfBoxOutputDevice
-
setBidiReorderer
public void setBidiReorderer(BidiReorderer reorderer)
- Specified by:
setBidiReordererin interfacePdfBoxOutputDevice
-
popTransforms
public void popTransforms(List<AffineTransform> inverse)
- Specified by:
popTransformsin interfaceOutputDevice- Specified by:
popTransformsin interfacePdfBoxOutputDevice
-
pushTransforms
public List<AffineTransform> pushTransforms(List<AffineTransform> transforms)
- Specified by:
pushTransformsin interfaceOutputDevice- Specified by:
pushTransformsin interfacePdfBoxOutputDevice
-
getAbsoluteTransformOriginX
public float getAbsoluteTransformOriginX()
- Specified by:
getAbsoluteTransformOriginXin interfaceOutputDevice- Specified by:
getAbsoluteTransformOriginXin interfacePdfBoxOutputDevice
-
getAbsoluteTransformOriginY
public float getAbsoluteTransformOriginY()
- Specified by:
getAbsoluteTransformOriginYin interfaceOutputDevice- Specified by:
getAbsoluteTransformOriginYin interfacePdfBoxOutputDevice
-
setPaint
public void setPaint(Paint paint)
- Specified by:
setPaintin interfaceOutputDevice- Specified by:
setPaintin interfacePdfBoxOutputDevice
-
isPDF
public boolean isPDF()
- Specified by:
isPDFin interfaceOutputDevice- Specified by:
isPDFin interfacePdfBoxOutputDevice- Overrides:
isPDFin classAbstractOutputDevice
-
close
public void close()
Perform any internal cleanup needed- Specified by:
closein interfacePdfBoxOutputDevice
-
pushTransformLayer
public void pushTransformLayer(AffineTransform transform)
- Specified by:
pushTransformLayerin interfaceOutputDevice- Specified by:
pushTransformLayerin interfacePdfBoxOutputDevice
-
popTransformLayer
public void popTransformLayer()
- Specified by:
popTransformLayerin interfaceOutputDevice- Specified by:
popTransformLayerin interfacePdfBoxOutputDevice
-
isFastRenderer
public boolean isFastRenderer()
- Specified by:
isFastRendererin interfaceOutputDevice- Specified by:
isFastRendererin interfacePdfBoxOutputDevice
-
startStructure
public Object startStructure(StructureType type, Box box)
- Specified by:
startStructurein interfaceOutputDevice
-
endStructure
public void endStructure(Object token)
- Specified by:
endStructurein interfaceOutputDevice
-
-