net.sf.jasperreports.engine.export
Class JRPdfExporter

java.lang.Object
  extended bynet.sf.jasperreports.engine.JRAbstractExporter
      extended bynet.sf.jasperreports.engine.export.JRPdfExporter
All Implemented Interfaces:
JRExporter

public class JRPdfExporter
extends JRAbstractExporter

Exports a JasperReports document to PDF format. It has binary output type and exports the document to a free-form layout.

Since classic AWT fonts can be sometimes very different from PDF fonts, a font mapping feature was added. By using the JRExporterParameter.FONT_MAP parameter, a logical font like "sansserif" can be mapped to a system specific font, like "Helvetica-BoldOblique". PDF font mapping is a little more complicated, because for a logical font, PDF cand provide two or more fonts, from the same family but with different styles (like "Helvetica", "Helvetica-Bold", "Helvetica-BoldOblique"). So every key in the map is a simple bean containing font family, bold and italic flag, and every value is another bean containing the PDF font name, encoding and embedding flag.

Version:
$Id: JRPdfExporter.java,v 1.63 2005/08/26 09:44:30 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)
See Also:
FontKey, PdfFont

Nested Class Summary
protected static class JRPdfExporter.Bookmark
           
protected static class JRPdfExporter.BookmarkStack
           
 
Field Summary
protected  com.lowagie.text.Document document
           
protected static boolean fontsRegistered
           
protected  com.lowagie.text.Document imageTesterDocument
           
protected  com.lowagie.text.pdf.PdfContentByte imageTesterPdfContentByte
           
protected  boolean is128BitKey
           
protected  boolean isCreatingBatchModeBookmarks
           
protected  boolean isEncrypted
           
protected static java.lang.String JR_PAGE_ANCHOR_PREFIX
           
protected  java.util.Map loadedImagesMap
           
protected  java.lang.String ownerPassword
           
protected  com.lowagie.text.pdf.PdfContentByte pdfContentByte
           
protected  java.lang.Character pdfVersion
           
protected  int permissions
           
protected  JRExportProgressMonitor progressMonitor
           
protected  com.lowagie.text.Image pxImage
           
protected  int reportIndex
           
protected  java.lang.String userPassword
           
 
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
defaultFont, endPageIndex, globalOffsetX, globalOffsetY, isModeBatch, jasperPrint, jasperPrintList, parameters, startPageIndex, styledTextParser
 
Constructor Summary
JRPdfExporter()
           
 
Method Summary
protected  void addBookmark(int level, java.lang.String title, int x, int y)
           
protected  void exportBox(JRBox box, JRPrintElement element)
           
protected  void exportEllipse(JRPrintEllipse ellipse)
           
protected  void exportImage(JRPrintImage printImage)
           
protected  void exportLine(JRPrintLine line)
           
protected  void exportPage(JRPrintPage page)
           
protected  void exportRectangle(JRPrintRectangle rectangle)
           
 void exportReport()
          Actually starts the export process.
protected  void exportReportToStream(java.io.OutputStream os)
           
protected  void exportText(JRPrintText text)
           
protected  com.lowagie.text.Chunk getChunk(java.util.Map attributes, java.lang.String text)
           
protected  com.lowagie.text.Phrase getPhrase(JRStyledText styledText, JRPrintText textElement)
           
protected  com.lowagie.text.Image getPxImage()
           
protected  void initBookmarks()
           
protected static void registerFonts()
           
protected  void setAnchor(com.lowagie.text.Chunk chunk, JRPrintAnchor anchor, JRPrintElement element)
           
protected  void setHyperlinkInfo(com.lowagie.text.Chunk chunk, JRPrintText text)
           
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
getDefaultFont, getParameter, getParameters, getStyledText, setInput, setOffset, setOutput, setPageRange, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JR_PAGE_ANCHOR_PREFIX

protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX
See Also:
Constant Field Values

fontsRegistered

protected static boolean fontsRegistered

document

protected com.lowagie.text.Document document

pdfContentByte

protected com.lowagie.text.pdf.PdfContentByte pdfContentByte

imageTesterDocument

protected com.lowagie.text.Document imageTesterDocument

imageTesterPdfContentByte

protected com.lowagie.text.pdf.PdfContentByte imageTesterPdfContentByte

progressMonitor

protected JRExportProgressMonitor progressMonitor

reportIndex

protected int reportIndex

isCreatingBatchModeBookmarks

protected boolean isCreatingBatchModeBookmarks

isEncrypted

protected boolean isEncrypted

is128BitKey

protected boolean is128BitKey

userPassword

protected java.lang.String userPassword

ownerPassword

protected java.lang.String ownerPassword

permissions

protected int permissions

pdfVersion

protected java.lang.Character pdfVersion

loadedImagesMap

protected java.util.Map loadedImagesMap

pxImage

protected com.lowagie.text.Image pxImage
Constructor Detail

JRPdfExporter

public JRPdfExporter()
Method Detail

getPxImage

protected com.lowagie.text.Image getPxImage()

exportReport

public void exportReport()
                  throws JRException
Description copied from interface: JRExporter
Actually starts the export process.

Specified by:
exportReport in interface JRExporter
Specified by:
exportReport in class JRAbstractExporter
Throws:
JRException

exportReportToStream

protected void exportReportToStream(java.io.OutputStream os)
                             throws JRException
Throws:
JRException

exportPage

protected void exportPage(JRPrintPage page)
                   throws JRException,
                          com.lowagie.text.DocumentException,
                          java.io.IOException
Throws:
JRException
com.lowagie.text.DocumentException
java.io.IOException

exportLine

protected void exportLine(JRPrintLine line)

exportRectangle

protected void exportRectangle(JRPrintRectangle rectangle)

exportEllipse

protected void exportEllipse(JRPrintEllipse ellipse)

exportImage

protected void exportImage(JRPrintImage printImage)
                    throws com.lowagie.text.DocumentException,
                           java.io.IOException,
                           JRException
Throws:
com.lowagie.text.DocumentException
java.io.IOException
JRException

setHyperlinkInfo

protected void setHyperlinkInfo(com.lowagie.text.Chunk chunk,
                                JRPrintText text)

getPhrase

protected com.lowagie.text.Phrase getPhrase(JRStyledText styledText,
                                            JRPrintText textElement)
                                     throws JRException,
                                            com.lowagie.text.DocumentException,
                                            java.io.IOException
Throws:
JRException
com.lowagie.text.DocumentException
java.io.IOException

getChunk

protected com.lowagie.text.Chunk getChunk(java.util.Map attributes,
                                          java.lang.String text)
                                   throws JRException,
                                          com.lowagie.text.DocumentException,
                                          java.io.IOException
Throws:
JRException
com.lowagie.text.DocumentException
java.io.IOException

exportText

protected void exportText(JRPrintText text)
                   throws JRException,
                          com.lowagie.text.DocumentException,
                          java.io.IOException
Throws:
JRException
com.lowagie.text.DocumentException
java.io.IOException

exportBox

protected void exportBox(JRBox box,
                         JRPrintElement element)

registerFonts

protected static void registerFonts()

initBookmarks

protected void initBookmarks()

addBookmark

protected void addBookmark(int level,
                           java.lang.String title,
                           int x,
                           int y)

setAnchor

protected void setAnchor(com.lowagie.text.Chunk chunk,
                         JRPrintAnchor anchor,
                         JRPrintElement element)


© 2001-2005 JasperSoft Corporation www.jaspersoft.com