Package com.openhtmltopdf.pdfboxout
Interface PdfBoxOutputDevice
-
- All Superinterfaces:
OutputDevice
- All Known Implementing Classes:
PdfBoxFastOutputDevice,PdfBoxSlowOutputDevice
public interface PdfBoxOutputDevice extends OutputDevice
-
-
Method Summary
All Methods Instance Methods Abstract 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)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)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)voidtranslate(double tx, double ty)-
Methods inherited from interface com.openhtmltopdf.extend.OutputDevice
drawDebugOutline, drawLinearGradient, drawText, drawTextDecoration, drawTextDecoration, endStructure, paintBackground, paintBorder, paintBorder, paintCollapsedBorder, startStructure
-
-
-
-
Method Detail
-
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
void paintReplacedElement(RenderingContext c, BlockBox box)
- Specified by:
paintReplacedElementin interfaceOutputDevice
-
paintBackground
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
-
getDeviceLength
float getDeviceLength(float length)
Given a value in dots units, converts to PDF points.
-
drawBorderLine
void drawBorderLine(Shape bounds, int side, int lineWidth, boolean solid)
- Specified by:
drawBorderLinein interfaceOutputDevice
-
setColor
void setColor(FSColor color)
- Specified by:
setColorin interfaceOutputDevice
-
draw
void draw(Shape s)
- 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
void fill(Shape s)
- 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
Object getRenderingHint(RenderingHints.Key key)
- Specified by:
getRenderingHintin interfaceOutputDevice
-
setRenderingHint
void setRenderingHint(RenderingHints.Key key, Object value)
- Specified by:
setRenderingHintin interfaceOutputDevice
-
setFont
void setFont(FSFont font)
- Specified by:
setFontin interfaceOutputDevice
-
drawString
void drawString(String s, float x, float y, JustificationInfo info)
-
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
void setStroke(Stroke s)
- Specified by:
setStrokein interfaceOutputDevice
-
clip
void clip(Shape s)
- Specified by:
clipin interfaceOutputDevice
-
getClip
Shape getClip()
- Specified by:
getClipin interfaceOutputDevice
-
popClip
void popClip()
- Specified by:
popClipin interfaceOutputDevice
-
pushClip
void pushClip(Shape s)
- Specified by:
pushClipin interfaceOutputDevice
-
setClip
void setClip(Shape s)
- Specified by:
setClipin interfaceOutputDevice
-
getStroke
Stroke getStroke()
- Specified by:
getStrokein interfaceOutputDevice
-
realizeImage
void realizeImage(PdfBoxImage img)
-
drawImage
void drawImage(FSImage fsImage, int x, int y, boolean interpolate)
- Specified by:
drawImagein interfaceOutputDevice
-
getDotsPerPoint
float getDotsPerPoint()
-
start
void start(Document doc)
-
finish
void finish(RenderingContext c, Box root)
-
addMetadata
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- the name of the metadata element to add.
-
getMetadataByName
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- the metadata element name to locate.- Returns:
- the content value of the first found metadata element; otherwise null.
-
getMetadataListByName
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- the metadata element name to locate.- Returns:
- an ArrayList with matching content values; otherwise an empty list.
-
setMetadata
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.- Parameters:
name- the metadata element name to locate.
-
getSharedContext
SharedContext getSharedContext()
-
setSharedContext
void setSharedContext(SharedContext sharedContext)
-
setRoot
void setRoot(Box root)
-
getStartPageNo
int getStartPageNo()
-
setStartPageNo
void setStartPageNo(int startPageNo)
-
drawSelection
void drawSelection(RenderingContext c, InlineText inlineText)
- 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)- Specified by:
drawWithGraphicsin interfaceOutputDevice
-
findPagePositionsByID
List<PagePosition<Box>> findPagePositionsByID(CssContext c, Pattern pattern)
-
setRenderingContext
void setRenderingContext(RenderingContext result)
-
setBidiReorderer
void setBidiReorderer(BidiReorderer reorderer)
-
popTransforms
void popTransforms(List<AffineTransform> inverse)
- Specified by:
popTransformsin interfaceOutputDevice
-
pushTransforms
List<AffineTransform> pushTransforms(List<AffineTransform> transforms)
- Specified by:
pushTransformsin interfaceOutputDevice
-
getAbsoluteTransformOriginX
float getAbsoluteTransformOriginX()
- Specified by:
getAbsoluteTransformOriginXin interfaceOutputDevice
-
getAbsoluteTransformOriginY
float getAbsoluteTransformOriginY()
- Specified by:
getAbsoluteTransformOriginYin interfaceOutputDevice
-
setPaint
void setPaint(Paint paint)
- Specified by:
setPaintin interfaceOutputDevice
-
isPDF
boolean isPDF()
- Specified by:
isPDFin interfaceOutputDevice
-
close
void close()
Perform any internal cleanup needed
-
pushTransformLayer
void pushTransformLayer(AffineTransform transform)
- Specified by:
pushTransformLayerin interfaceOutputDevice
-
popTransformLayer
void popTransformLayer()
- Specified by:
popTransformLayerin interfaceOutputDevice
-
isFastRenderer
boolean isFastRenderer()
- Specified by:
isFastRendererin interfaceOutputDevice
-
getPageRefY
int getPageRefY(Box box)
-
getMetadata
List<com.openhtmltopdf.pdfboxout.PdfBoxSlowOutputDevice.Metadata> getMetadata()
-
drawPdfAsImage
void drawPdfAsImage(org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject _src, Rectangle contentBounds, float intrinsicWidth, float intrinsicHeight)
-
-