org.mapfish.print
Class PDFUtils

java.lang.Object
  extended by org.mapfish.print.PDFUtils

public class PDFUtils
extends java.lang.Object

Some utility functions for iText.


Field Summary
static org.apache.log4j.Logger LOGGER
           
 
Constructor Summary
PDFUtils()
           
 
Method Summary
static com.lowagie.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.lowagie.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.lowagie.text.Image createImage(RenderingContext context, double maxWidth, double maxHeight, java.net.URI url, float rotation)
           
static com.lowagie.text.Chunk createImageChunk(RenderingContext context, double maxWidth, double maxHeight, java.net.URI url, float rotation)
           
static com.lowagie.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)
          Evaluates stuff like "toto ${titi}"
static com.lowagie.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.
protected static com.lowagie.text.Image getImageDirect(RenderingContext context, java.net.URI uri)
          Gets an iText image.
static com.lowagie.text.Phrase renderString(RenderingContext context, PJsonObject params, java.lang.String val, com.lowagie.text.Font font)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

public static final org.apache.log4j.Logger LOGGER
Constructor Detail

PDFUtils

public PDFUtils()
Method Detail

getImage

public static com.lowagie.text.Image getImage(RenderingContext context,
                                              java.net.URI uri,
                                              float w,
                                              float h)
                                       throws java.io.IOException,
                                              com.lowagie.text.DocumentException
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.

Throws:
java.io.IOException
com.lowagie.text.DocumentException

getImageDirect

protected static com.lowagie.text.Image getImageDirect(RenderingContext context,
                                                       java.net.URI uri)
                                                throws java.io.IOException,
                                                       com.lowagie.text.DocumentException
Gets an iText image. Avoids doing the query twice.

Throws:
java.io.IOException
com.lowagie.text.DocumentException

createPlaceholderTable

public static com.lowagie.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. When that happens, we use the given drawer to do the actual drawing.


renderString

public static com.lowagie.text.Phrase renderString(RenderingContext context,
                                                   PJsonObject params,
                                                   java.lang.String val,
                                                   com.lowagie.text.Font font)
                                            throws com.lowagie.text.BadElementException
Throws:
com.lowagie.text.BadElementException

evalString

public static java.lang.String evalString(RenderingContext context,
                                          PJsonObject params,
                                          java.lang.String val)
Evaluates stuff like "toto ${titi}"


buildTable

public static com.lowagie.text.pdf.PdfPTable buildTable(java.util.List<Block> items,
                                                        PJsonObject params,
                                                        RenderingContext context,
                                                        int nbColumns,
                                                        TableConfig tableConfig)
                                                 throws com.lowagie.text.DocumentException
Creates a PDF table with the given items. Returns null if the table is empty

Throws:
com.lowagie.text.DocumentException

createCell

public static com.lowagie.text.pdf.PdfPCell createCell(PJsonObject params,
                                                       RenderingContext context,
                                                       Block block,
                                                       int row,
                                                       int col,
                                                       int nbRows,
                                                       int nbCols,
                                                       TableConfig tableConfig)
                                                throws com.lowagie.text.DocumentException
Create a PDF table cell with support for styling using the CellConfig stuff.

Throws:
com.lowagie.text.DocumentException

createImageChunk

public static com.lowagie.text.Chunk createImageChunk(RenderingContext context,
                                                      double maxWidth,
                                                      double maxHeight,
                                                      java.net.URI url,
                                                      float rotation)
                                               throws com.lowagie.text.DocumentException
Throws:
com.lowagie.text.DocumentException

createImage

public static com.lowagie.text.Image createImage(RenderingContext context,
                                                 double maxWidth,
                                                 double maxHeight,
                                                 java.net.URI url,
                                                 float rotation)
                                          throws com.lowagie.text.DocumentException
Throws:
com.lowagie.text.DocumentException


Copyright © 2009 Camptocamp SA. All Rights Reserved.