Class ITextOutputDevice
java.lang.Object
org.xhtmlrenderer.render.AbstractOutputDevice
org.xhtmlrenderer.pdf.ITextOutputDevice
- All Implemented Interfaces:
OutputDevice
This class is largely based on
PdfGraphics2D.
See http://sourceforge.net/
projects/itext/ for license information.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<ITextOutputDevice.Bookmark> private @Nullable Areaprivate Colorprivate @Nullable com.lowagie.text.pdf.PdfContentByteprivate @Nullable com.lowagie.text.pdf.PdfDestinationprivate final floatprivate @Nullable Colorprivate @Nullable ITextFSFontprivate final List<@Nullable ITextOutputDevice.Metadata> private intprivate @Nullable Strokeprivate @Nullable Strokeprivate floatprivate @Nullable Boxprivate @Nullable SharedContextprivate intprivate @Nullable Strokeprivate @Nullable Colorprivate AffineTransformprivate @Nullable com.lowagie.text.pdf.PdfWriterprivate static final intprivate static final intprivate static final AffineTransformprivate static final booleanprivate static final intprivate static final BasicStroke -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate com.lowagie.text.Rectangleadd(com.lowagie.text.Rectangle r1, com.lowagie.text.Rectangle r2) private voidaddLinkAnnotation(com.lowagie.text.pdf.PdfAction action, com.lowagie.text.Rectangle targetArea) voidaddMetadata(String name, String value) Appends a name/content metadata pair to this output device.private @Nullable PagePositioncalcPDFPagePosition(CssContext c, String id, Box box) private com.lowagie.text.RectanglecalcTotalLinkArea(RenderingContext c, Box box) private Optional<com.lowagie.text.Rectangle> checkLinkArea(RenderingContext c, Box box) voidprivate @Nullable com.lowagie.text.pdf.PdfDestinationcreateDestination(RenderingContext c, Box box) com.lowagie.text.RectanglecreateLocalTargetArea(RenderingContext c, Box box) private com.lowagie.text.RectanglecreateLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) private StringcreateRectKey(com.lowagie.text.Rectangle rect) com.lowagie.text.RectanglecreateTargetArea(RenderingContext c, Box box) voidvoiddrawBorderLine(Shape bounds, int side, int lineWidth, boolean solid) voidprotected voiddrawLine(int x1, int y1, int x2, int y2) voiddrawOval(int x, int y, int width, int height) private voiddrawPDFAsImage(PDFAsImage image, int x, int y) voiddrawRect(int x, int y, int width, int height) voiddrawSelection(RenderingContext c, InlineText inlineText) voiddrawString(String s, float x, float y, @Nullable JustificationInfo info) private voidprivate voidvoidvoidfillOval(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) voidprivate voidfollowPath(Shape s, int drawType) @Nullable ShapegetClip()com.lowagie.text.pdf.PdfContentBytefloatgetDeviceLength(float length) float@Nullable 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.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.intprivate intgetPageRefY(Box box) com.lowagie.text.pdf.PdfReader@Nullable Objectint@Nullable com.lowagie.text.pdf.PdfWriterprivate static com.lowagie.text.pdf.PdfActiongotoDestination(com.lowagie.text.pdf.PdfDestination dest) voidinitializePage(com.lowagie.text.pdf.PdfContentByte currentPage, float height) private booleanisMakeDash(boolean oldOk, BasicStroke nStroke, BasicStroke oStroke) booleanbooleanprivate voidloadBookmark(ITextOutputDevice.Bookmark parent, Element bookmark) private voidloadBookmarks(Document doc) private voidloadMetadata(Document doc) Locates and stores all metadata values in the document head that contain name/content pairs.private com.lowagie.text.pdf.PdfTextArrayprivate AffineTransformnormalizeMatrix(AffineTransform current) private floatnormalizeY(float y) private voidnormalizeY(float[] coords) voidpaintBackground(RenderingContext c, Box box) voidprivate voidprocessLink(RenderingContext c, Box box) private StringreplaceMissingCharacters(String string) voidvoidvoidvoidsetMetadata(String name, String value) Replaces all copies of the named metadata with a single value.voidsetRenderingHint(RenderingHints.Key key, Object value) voidvoidsetSharedContext(SharedContext sharedContext) voidsetStartPageNo(int startPageNo) voidprivate voidsetStrokeDiff(Stroke newStroke, @Nullable Stroke oldStroke) voidsetWriter(com.lowagie.text.pdf.PdfWriter writer) voidprivate StroketransformStroke(Stroke stroke) voidtranslate(double tx, double ty) private voidwriteBookmark(RenderingContext c, Box root, com.lowagie.text.pdf.PdfOutline parent, ITextOutputDevice.Bookmark bookmark) private voidwriteBookmarks(RenderingContext c, Box root, com.lowagie.text.pdf.PdfOutline parent, List<ITextOutputDevice.Bookmark> bookmarks) private voidprivate voidwriteOutline(RenderingContext c, Box root) Methods inherited from class AbstractOutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, getFontSpecification, paintBackground, paintBorder, paintBorder, paintCollapsedBorder, setFontSpecificationMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface OutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, paintBackground, paintBorder, paintBorder, paintCollapsedBorder
-
Field Details
-
FILL
private static final int FILL- See Also:
-
STROKE
private static final int STROKE- See Also:
-
CLIP
private static final int CLIP- See Also:
-
IDENTITY
-
STROKE_ONE
-
ROUND_RECT_DIMENSIONS_DOWN
private static final boolean ROUND_RECT_DIMENSIONS_DOWN -
_currentPage
private @Nullable com.lowagie.text.pdf.PdfContentByte _currentPage -
_pageHeight
private float _pageHeight -
_font
-
_transform
-
_color
-
_fillColor
-
_strokeColor
-
_stroke
-
_originalStroke
-
_oldStroke
-
_clip
-
_dotsPerPoint
private final float _dotsPerPoint -
_writer
private @Nullable com.lowagie.text.pdf.PdfWriter _writer -
_readerCache
-
_defaultDestination
private @Nullable com.lowagie.text.pdf.PdfDestination _defaultDestination -
_bookmarks
-
_metadata
-
_root
-
_startPageNo
private int _startPageNo -
_nextFormFieldIndex
private int _nextFormFieldIndex -
_linkTargetAreas
-
-
Constructor Details
-
ITextOutputDevice
public ITextOutputDevice(float dotsPerPoint)
-
-
Method Details
-
setWriter
public void setWriter(com.lowagie.text.pdf.PdfWriter writer) -
getWriter
public @Nullable com.lowagie.text.pdf.PdfWriter getWriter() -
getNextFormFieldIndex
public int getNextFormFieldIndex() -
initializePage
public void initializePage(com.lowagie.text.pdf.PdfContentByte currentPage, float height) -
finishPage
public void finishPage() -
paintReplacedElement
- Specified by:
paintReplacedElementin interfaceOutputDevice
-
paintBackground
- Specified by:
paintBackgroundin interfaceOutputDevice- Overrides:
paintBackgroundin classAbstractOutputDevice
-
calcTotalLinkArea
-
add
private com.lowagie.text.Rectangle add(com.lowagie.text.Rectangle r1, com.lowagie.text.Rectangle r2) -
createRectKey
-
checkLinkArea
-
processLink
-
gotoDestination
private static com.lowagie.text.pdf.PdfAction gotoDestination(com.lowagie.text.pdf.PdfDestination dest) -
addLinkAnnotation
private void addLinkAnnotation(com.lowagie.text.pdf.PdfAction action, com.lowagie.text.Rectangle targetArea) -
createLocalTargetArea
-
createLocalTargetArea
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) -
createTargetArea
-
getDeviceLength
public float getDeviceLength(float length) -
createDestination
private @Nullable com.lowagie.text.pdf.PdfDestination createDestination(RenderingContext c, Box box) -
drawBorderLine
- Specified by:
drawBorderLinein interfaceOutputDevice
-
setColor
- Specified by:
setColorin interfaceOutputDevice
-
draw
- Specified by:
drawin interfaceOutputDevice
-
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
-
drawOval
public void drawOval(int x, int y, int width, int height) - Specified by:
drawOvalin interfaceOutputDevice
-
fill
- Specified by:
fillin interfaceOutputDevice
-
fillRect
public void fillRect(int x, int y, int width, int height) - Specified by:
fillRectin interfaceOutputDevice
-
fillOval
public void fillOval(int x, int y, int width, int height) - Specified by:
fillOvalin interfaceOutputDevice
-
translate
public 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
-
normalizeMatrix
-
drawString
-
replaceMissingCharacters
-
makeJustificationArray
-
getTransform
-
ensureFillColor
private void ensureFillColor() -
ensureStrokeColor
private void ensureStrokeColor() -
getCurrentPage
public com.lowagie.text.pdf.PdfContentByte getCurrentPage() -
followPath
-
normalizeY
private float normalizeY(float y) -
normalizeY
private void normalizeY(float[] coords) -
setStrokeDiff
-
isMakeDash
-
setStroke
- Specified by:
setStrokein interfaceOutputDevice
-
transformStroke
-
clip
- Specified by:
clipin interfaceOutputDevice
-
getClip
- Specified by:
getClipin interfaceOutputDevice
-
setClip
- Specified by:
setClipin interfaceOutputDevice
-
getStroke
- Specified by:
getStrokein interfaceOutputDevice
-
drawImage
- Specified by:
drawImagein interfaceOutputDevice
-
drawPDFAsImage
-
getReader
- Throws:
IOException
-
getDotsPerPoint
public float getDotsPerPoint() -
start
-
finish
-
writeOutline
-
writeBookmarks
private void writeBookmarks(RenderingContext c, Box root, com.lowagie.text.pdf.PdfOutline parent, List<ITextOutputDevice.Bookmark> bookmarks) -
writeNamedDestinations
-
getPageRefY
-
writeBookmark
private void writeBookmark(RenderingContext c, Box root, com.lowagie.text.pdf.PdfOutline parent, ITextOutputDevice.Bookmark bookmark) -
loadBookmarks
-
loadBookmark
-
addMetadata
-
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.
-
loadMetadata
Locates and stores all metadata values in the document head that contain name/content pairs. If there is no pair with a name of "title", any content in the title element is saved as a "title" metadata item.- Parameters:
doc- the Document level node of the parsed xhtml file.
-
setMetadata
Replaces all copies of the named metadata with a single value. 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
public int getStartPageNo() -
setStartPageNo
public void setStartPageNo(int startPageNo) -
drawSelection
- Specified by:
drawSelectionin interfaceOutputDevice
-
isSupportsSelection
public boolean isSupportsSelection()- Specified by:
isSupportsSelectionin interfaceOutputDevice
-
isSupportsCMYKColors
public boolean isSupportsCMYKColors()- Specified by:
isSupportsCMYKColorsin interfaceOutputDevice
-
findPagePositionsByID
-
calcPDFPagePosition
-