public final class PDStreamUtils extends Object
Utility methods for PDPageContentStream
| Modifier and Type | Method and Description |
|---|---|
static void |
rect(PageContentStreamOptimized stream,
float x,
float y,
float width,
float height,
Color color)
Provides ability to draw rectangle for debugging purposes.
|
static void |
rectFontMetrics(PageContentStreamOptimized stream,
float x,
float y,
org.apache.pdfbox.pdmodel.font.PDFont font,
float fontSize)
Provides ability to draw font metrics (font height, font ascent, font
descent).
|
static void |
setLineStyles(PageContentStreamOptimized stream,
LineStyle line)
Provides ability to set different line styles (line width, dotted line,
dashed line)
|
static void |
write(PageContentStreamOptimized stream,
String text,
org.apache.pdfbox.pdmodel.font.PDFont font,
float fontSize,
float x,
float y,
Color color)
Provides ability to write on a
PDPageContentStream. |
public static void write(PageContentStreamOptimized stream, String text, org.apache.pdfbox.pdmodel.font.PDFont font, float fontSize, float x, float y, Color color)
Provides ability to write on a PDPageContentStream. The text will
be written above Y coordinate.
stream - The PDPageContentStream where writing will be applied.text - The text which will be displayed.font - The font of the textfontSize - The font size of the textx - Start X coordinate for text.y - Start Y coordinate for text.color - Color of the textpublic static void rect(PageContentStreamOptimized stream, float x, float y, float width, float height, Color color)
Provides ability to draw rectangle for debugging purposes.
stream - The PDPageContentStream where drawing will be applied.x - Start X coordinate for rectangle.y - Start Y coordinate for rectangle.width - Width of rectangleheight - Height of rectanglecolor - Color of the textpublic static void rectFontMetrics(PageContentStreamOptimized stream, float x, float y, org.apache.pdfbox.pdmodel.font.PDFont font, float fontSize)
Provides ability to draw font metrics (font height, font ascent, font descent).
stream - The PDPageContentStream where drawing will be applied.x - Start X coordinate for rectangle.y - Start Y coordinate for rectangle.font - PDFont from which will be obtained font metricsfontSize - Font sizepublic static void setLineStyles(PageContentStreamOptimized stream, LineStyle line) throws IOException
Provides ability to set different line styles (line width, dotted line, dashed line)
stream - The PDPageContentStream where drawing will be applied.line - The LineStyle that would be appliedIOException - If the content stream could not be written or the line color cannot be retrieved.Copyright © 2020. All rights reserved.