Package be.quodlibet.boxable.utils
Class PDStreamUtils
java.lang.Object
be.quodlibet.boxable.utils.PDStreamUtils
Utility methods for PDPageContentStream
- Author:
- hstimac, mkuehne
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrect(PageContentStreamOptimized stream, float x, float y, float width, float height, Color color) Provides ability to draw rectangle for debugging purposes.static voidrectFontMetrics(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 voidsetLineStyles(PageContentStreamOptimized stream, LineStyle line) Provides ability to set different line styles (line width, dotted line, dashed line)static voidwrite(PageContentStreamOptimized stream, String text, org.apache.pdfbox.pdmodel.font.PDFont font, float fontSize, float x, float y, Color color) Provides ability to write on aPDPageContentStream.
-
Method Details
-
write
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.- Parameters:
stream- ThePDPageContentStreamwhere 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 text
-
rect
public static void rect(PageContentStreamOptimized stream, float x, float y, float width, float height, Color color) Provides ability to draw rectangle for debugging purposes.
- Parameters:
stream- ThePDPageContentStreamwhere 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 text
-
rectFontMetrics
public 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).
- Parameters:
stream- ThePDPageContentStreamwhere drawing will be applied.x- Start X coordinate for rectangle.y- Start Y coordinate for rectangle.font-PDFontfrom which will be obtained font metricsfontSize- Font size
-
setLineStyles
public static void setLineStyles(PageContentStreamOptimized stream, LineStyle line) throws IOException Provides ability to set different line styles (line width, dotted line, dashed line)
- Parameters:
stream- ThePDPageContentStreamwhere drawing will be applied.line- TheLineStylethat would be applied- Throws:
IOException- If the content stream could not be written or the line color cannot be retrieved.
-