public class PDFUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
LOGGER |
| Constructor and Description |
|---|
PDFUtils() |
| Modifier and Type | Method and Description |
|---|---|
static com.itextpdf.text.pdf.PdfPTable |
buildTable(java.util.List<Block> items,
PJsonObject params,
RenderingContext context,
int nbColumns,
TableConfig tableConfig)
Creates a PDF table with the given items.
|
static com.itextpdf.text.pdf.PdfPCell |
createCell(PJsonObject params,
RenderingContext context,
Block block,
int row,
int col,
int nbRows,
int nbCols,
TableConfig tableConfig)
Create a PDF table cell with support for styling using the
CellConfig stuff. |
static com.itextpdf.text.Image |
createImage(RenderingContext context,
double maxWidth,
double maxHeight,
float scale,
java.net.URI url,
float rotation) |
static com.itextpdf.text.Image |
createImage(RenderingContext context,
double maxWidth,
double maxHeight,
java.net.URI url,
float rotation) |
static com.itextpdf.text.Chunk |
createImageChunk(RenderingContext context,
double maxWidth,
double maxHeight,
float scale,
java.net.URI url,
float rotation) |
static com.itextpdf.text.Chunk |
createImageChunk(RenderingContext context,
double maxWidth,
double maxHeight,
java.net.URI url,
float rotation) |
static com.itextpdf.text.Chunk |
createImageChunkFromSVG(RenderingContext context,
java.lang.String iconItem,
double maxIconWidth,
double maxIconHeight,
double scale) |
static com.itextpdf.text.Image |
createImageFromSVG(RenderingContext context,
java.lang.String iconItem,
double maxIconWidth,
double maxIconHeight,
double scale) |
static com.itextpdf.text.pdf.PdfPTable |
createPlaceholderTable(double width,
double height,
double spacingAfter,
ChunkDrawer drawer,
HorizontalAlign align,
PDFCustomBlocks customBlocks)
When we have to do some custom drawing in a block that is layed out by
iText, we first give an empty table with the good dimensions to iText,
then iText will call a callback with the actual position.
|
static java.lang.String |
evalString(RenderingContext context,
PJsonObject params,
java.lang.String val,
java.lang.String mapName)
Evaluates stuff like "toto ${titi}"
|
static com.itextpdf.text.pdf.BaseFont |
getBaseFont(java.lang.String fontFamily,
java.lang.String fontSize,
java.lang.String fontWeight) |
static int |
getHorizontalAlignment(java.lang.String labelAlign) |
static com.itextpdf.text.Image |
getImage(RenderingContext context,
java.net.URI uri,
float w,
float h)
Gets an iText image with a cache that uses PdfTemplates to re-use the same
bitmap content multiple times in order to reduce the file size.
|
static com.itextpdf.text.Image |
getImage(RenderingContext context,
java.net.URI uri,
float w,
float h,
float scale)
Gets an iText image with a cache that uses PdfTemplates to re-use the same
bitmap content multiple times in order to reduce the file size.
|
protected static com.itextpdf.text.Image |
getImageDirect(RenderingContext context,
java.net.URI uri)
Gets an iText image.
|
static java.lang.String |
getValueFromString(java.lang.String val) |
static float |
getVerticalOffset(java.lang.String labelAlign,
float fontHeight) |
static com.itextpdf.text.Image |
handleImageLoadError(RenderingContext context,
java.lang.String errorMessage)
In the case url fails to load an image this method should be called to handle the issue.
|
static com.itextpdf.text.Phrase |
renderString(RenderingContext context,
PJsonObject params,
java.lang.String val,
com.itextpdf.text.Font font,
java.lang.String mapName) |
public static com.itextpdf.text.Image getImage(RenderingContext context, java.net.URI uri, float w, float h) throws java.io.IOException, com.itextpdf.text.DocumentException
java.io.IOExceptioncom.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Image getImage(RenderingContext context, java.net.URI uri, float w, float h, float scale) throws java.io.IOException, com.itextpdf.text.DocumentException
java.io.IOExceptioncom.itextpdf.text.DocumentExceptionprotected static com.itextpdf.text.Image getImageDirect(RenderingContext context, java.net.URI uri) throws java.io.IOException, com.itextpdf.text.DocumentException
java.io.IOExceptioncom.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Image handleImageLoadError(RenderingContext context, java.lang.String errorMessage) throws java.io.IOException, com.itextpdf.text.DocumentException
context - the context.errorMessage - the message of the error to throw in the case the configuration requires it.java.io.IOExceptioncom.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.pdf.PdfPTable createPlaceholderTable(double width,
double height,
double spacingAfter,
ChunkDrawer drawer,
HorizontalAlign align,
PDFCustomBlocks customBlocks)
public static com.itextpdf.text.Phrase renderString(RenderingContext context, PJsonObject params, java.lang.String val, com.itextpdf.text.Font font, java.lang.String mapName) throws com.itextpdf.text.BadElementException
com.itextpdf.text.BadElementExceptionpublic static java.lang.String evalString(RenderingContext context, PJsonObject params, java.lang.String val, java.lang.String mapName)
public static java.lang.String getValueFromString(java.lang.String val)
public static com.itextpdf.text.pdf.PdfPTable buildTable(java.util.List<Block> items, PJsonObject params, RenderingContext context, int nbColumns, TableConfig tableConfig) throws com.itextpdf.text.DocumentException
com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.pdf.PdfPCell createCell(PJsonObject params, RenderingContext context, Block block, int row, int col, int nbRows, int nbCols, TableConfig tableConfig) throws com.itextpdf.text.DocumentException
CellConfig stuff.com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Chunk createImageChunk(RenderingContext context, double maxWidth, double maxHeight, java.net.URI url, float rotation) throws com.itextpdf.text.DocumentException
com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Chunk createImageChunk(RenderingContext context, double maxWidth, double maxHeight, float scale, java.net.URI url, float rotation) throws com.itextpdf.text.DocumentException
com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Image createImage(RenderingContext context, double maxWidth, double maxHeight, java.net.URI url, float rotation) throws com.itextpdf.text.DocumentException
com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.Image createImage(RenderingContext context, double maxWidth, double maxHeight, float scale, java.net.URI url, float rotation) throws com.itextpdf.text.DocumentException
com.itextpdf.text.DocumentExceptionpublic static com.itextpdf.text.pdf.BaseFont getBaseFont(java.lang.String fontFamily,
java.lang.String fontSize,
java.lang.String fontWeight)
public static int getHorizontalAlignment(java.lang.String labelAlign)
public static float getVerticalOffset(java.lang.String labelAlign,
float fontHeight)
public static com.itextpdf.text.Chunk createImageChunkFromSVG(RenderingContext context, java.lang.String iconItem, double maxIconWidth, double maxIconHeight, double scale) throws java.io.IOException
java.io.IOExceptionpublic static com.itextpdf.text.Image createImageFromSVG(RenderingContext context, java.lang.String iconItem, double maxIconWidth, double maxIconHeight, double scale) throws java.io.IOException
java.io.IOException