|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsferyx.administration.pdfgenerator.PDFGenerator
public class PDFGenerator
General purpose PDF Generator - this class provides fully featured generation of PDF files from various sources containing HTML or plain text content.
Field Summary | |
---|---|
static boolean |
debug
|
static java.lang.String |
replacementFontFamily
|
Constructor Summary | |
---|---|
PDFGenerator()
Creates a new instance of PDFGenerator |
Method Summary | |
---|---|
void |
addFileAttachmentToContentBuffer(java.lang.String htmlContent,
java.net.URL fileAttachment)
Adds file attachment with the specified content to describe the attached file - it can be any HTML formatted string. |
void |
addPageBreakToContentBuffer()
Adds a page break to the content buffer and all the content appended after that will be on the next page |
void |
appendAlternativeFooterToContentBuffer(java.lang.String content)
Sets alternative Page Footer to be used for the pages to follow - it can contain any HTML formatting. |
void |
appendAlternativeHeaderToContentBuffer(java.lang.String content)
Sets alternative Page Header to be used for the pages to follow - it can contain any HTML formatting. |
void |
appendDocxToContentBuffer(java.io.File file)
Appends the whole content of the Docx file from the File to the content buffer |
void |
appendDocxToContentBuffer(java.net.URL file)
Appends the whole content of the Docx file from the given URL to the content buffer |
void |
appendHTMLContentToContentBuffer(java.lang.String content)
Appends new string to existing content buffer. |
void |
appendPlainTextContentToContentBuffer(java.lang.String content)
Appends the Plain Text string content to the content buffer |
void |
appendRTFBase64EncodedStringToContentBuffer(java.lang.String base64EncodedRTFString)
Appends RTF content encoded as Base64 string to the content buffer |
void |
appendRTFFileToContentBuffer(java.io.InputStream is)
Appends RTF file from the InputStream to the content buffer |
void |
appendRTFFileToContentBuffer(java.net.URL file)
Appends RTF file from the URL to the content buffer |
void |
clearContentBuffer()
Closes the content buffer and clears the content |
void |
closeBufferAndGeneratePDF(java.io.OutputStream destinationStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. |
void |
closeBufferAndGeneratePDF(java.io.OutputStream destinationStream,
java.lang.String standardPageFormat,
java.lang.String orientation)
Closes the existing content buffer and inserts its content inside the editor. |
void |
closeBufferAndGeneratePDF(java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given content buffer created prevuiously by using openContentBuffer() and appendContentXXX() methods. |
void |
generatePDFFromContent(java.lang.String content,
java.io.OutputStream destinationStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given html content. |
void |
generatePDFFromContent(java.lang.String content,
java.io.OutputStream destinationStream,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given html content. |
void |
generatePDFFromContent(java.lang.String content,
java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given html content. |
void |
generatePDFFromDocxURL(java.lang.String sourceURL,
java.io.File destinationFile,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source containing a MS Word Docx file. |
void |
generatePDFFromDocxURL(java.lang.String sourceURL,
java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given URL source containing a MS Word Docx file. |
void |
generatePDFFromPlainTextContent(java.lang.String content,
java.io.OutputStream destinationStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given plain text content. |
void |
generatePDFFromPlainTextContent(java.lang.String content,
java.io.OutputStream destinationStream,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given text content. |
void |
generatePDFFromPlainTextContent(java.lang.String content,
java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given text content. |
void |
generatePDFFromRTFContentBase64String(java.lang.String rtfString,
java.io.OutputStream outputStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given RTF base64 encoded string containing Rich Text Format RTF. |
void |
generatePDFFromRTFContentBase64String(java.lang.String rtfString,
java.io.OutputStream outputStream,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given RTF base64 encoded string containing Rich Text Format content. |
void |
generatePDFFromRTFInputStream(java.io.InputStream rtfStream,
java.io.OutputStream outputStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given RTF inputStream containing Rich Text Format RTF. |
void |
generatePDFFromRTFInputStream(java.io.InputStream inputStream,
java.io.OutputStream outputStream,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given RTF InputStream containing Rich Text Format content. |
void |
generatePDFFromRTFURL(java.lang.String sourceURL,
java.io.File destinationFile,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source containing Rich Text Format RTF file. |
void |
generatePDFFromRTFURL(java.lang.String sourceURL,
java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given URL source containing Rich Text Format RTF file. |
void |
generatePDFFromURL(java.lang.String sourceURL)
Generates pdf automatically for given URL source. |
void |
generatePDFFromURL(java.lang.String sourceURL,
java.io.File destinationFile,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source. |
void |
generatePDFFromURL(java.lang.String sourceURL,
java.io.OutputStream destinationStream,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source. |
void |
generatePDFFromURL(java.lang.String sourceURL,
java.lang.String destinationFile)
Generates pdf automatically for given URL source. |
void |
generatePDFFromURL(java.lang.String sourceURL,
java.lang.String destinationFile,
java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source. |
void |
generatePDFFromURL(java.lang.String sourceURL,
java.lang.String destinationFile,
java.lang.String standardPageFormat,
java.lang.String orientation)
Generates pdf automatically for given URL source. |
java.lang.String |
getTTFFontFolderName()
|
boolean |
getXMLMode()
Returns the XML mode for the renderer. |
boolean |
isDoNotBreakListsAcrossPages()
Returns wether the PDFGenerator will try to not break lists when page break is encountered if the list is not longer than the page height. |
boolean |
isDoNotBreakTableRowsAcrossPages()
Returns wether the PDFGenerator will try to not break table rows when page break is encountered if the table row is not longer than the page height. |
boolean |
isDoNotBreakTablesAcrossPages()
Returns wether the PDFGenerator will try to not break tables when page break is encountered if the table is not longer than the page height. |
boolean |
isPDFAComplianceEnabled()
Returns whether the PDF/A standard compliance is enabled or not. |
static void |
main(java.lang.String[] args)
|
void |
openContentBuffer()
Opens the new content buffer for inserting content to be used for dynamic PDF generation. |
void |
setCharset(java.lang.String charset)
Set character set for proper pdf generation in non western languages |
void |
setDiscardEmptyPages(boolean discard)
Specifies to automatically discard all pages that do not contain text and are practically a blank pages. |
void |
setDoNotBreakListsAcrossPages(boolean disablebreak)
If set to true, the PDFGenerator will try to not break lists when page break is encountered if the list is not longer than the page height. |
void |
setDoNotBreakTableRowsAcrossPages(boolean disablebreak)
If set to true, the PDFGenerator will try to not break table rows when page break is encountered if the table row is not longer than the page height. |
void |
setDoNotBreakTablesAcrossPages(boolean disablebreak)
If set to true, the PDFGenerator will try to not break tables when page break is encountered if the table is not longer than the page height. |
void |
setFirstPageHeader(java.lang.String content)
Generates the first page header for the document. |
void |
setFooter(java.lang.String content)
Generates the footer for each page in the document. |
void |
setGeneratePageNumbers(boolean generate,
java.lang.String text)
Generates page numbers for each page in the document. |
void |
setHeader(java.lang.String content)
Generates the header for each page in the document. |
void |
setMarginsForStandardPageFormat(int top,
int bottom,
int left,
int right)
Sets the margins to be used when the page format is set using the standard string like "A4" or "Letter" - this values will not be considered it PageFormat object is used to set the page format |
void |
setPDFAComplianceEnabled(boolean enabled)
Sets the PDF/A standard compliance - the default is true - to generate PDF/A compliant files you have to enable also the embedding of all fonts inside the document with setCharset("utf-8") |
void |
setReplaceFontFamilyAutomatically(java.lang.String newFontFamily)
Specifies to automatically replace all font familiy inside the diocument with the sepcified one. |
void |
setScaleToFitWidth(boolean scale)
Indicates whether to rescale the page in order to fit the give PageFormat - the default is true |
void |
setTTFFontFolderName(java.lang.String folderName)
Set the absolute path to the folder which contains the TrueType fonts to be used when generatiing the PDF documents. |
void |
setXMLMode(boolean mode)
Sets the XML mode for the renderer - this will define how custom XML tags will be rendered. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean debug
public static java.lang.String replacementFontFamily
Constructor Detail |
---|
public PDFGenerator()
Method Detail |
---|
public void setTTFFontFolderName(java.lang.String folderName)
public java.lang.String getTTFFontFolderName()
public void setCharset(java.lang.String charset)
public void generatePDFFromURL(java.lang.String sourceURL)
public void generatePDFFromURL(java.lang.String sourceURL, java.lang.String destinationFile)
public void generatePDFFromURL(java.lang.String sourceURL, java.lang.String destinationFile, java.awt.print.PageFormat pageFormat)
public void generatePDFFromURL(java.lang.String sourceURL, java.io.OutputStream destinationStream, java.awt.print.PageFormat pageFormat) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void generatePDFFromURL(java.lang.String sourceURL, java.io.File destinationFile, java.awt.print.PageFormat pageFormat) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void generatePDFFromURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
public void generatePDFFromDocxURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation) throws java.io.FileNotFoundException, java.net.MalformedURLException
java.io.FileNotFoundException
java.net.MalformedURLException
public void generatePDFFromDocxURL(java.lang.String sourceURL, java.io.File destinationFile, java.awt.print.PageFormat pageFormat) throws java.io.FileNotFoundException, java.net.MalformedURLException
java.io.FileNotFoundException
java.net.MalformedURLException
public void generatePDFFromRTFURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation) throws java.io.FileNotFoundException, java.net.MalformedURLException
java.io.FileNotFoundException
java.net.MalformedURLException
public void generatePDFFromRTFContentBase64String(java.lang.String rtfString, java.io.OutputStream outputStream, java.lang.String standardPageFormat, java.lang.String orientation)
public void generatePDFFromRTFInputStream(java.io.InputStream inputStream, java.io.OutputStream outputStream, java.lang.String standardPageFormat, java.lang.String orientation)
public void generatePDFFromRTFURL(java.lang.String sourceURL, java.io.File destinationFile, java.awt.print.PageFormat pageFormat) throws java.io.FileNotFoundException, java.net.MalformedURLException
java.io.FileNotFoundException
java.net.MalformedURLException
public void generatePDFFromRTFContentBase64String(java.lang.String rtfString, java.io.OutputStream outputStream, java.awt.print.PageFormat pageFormat)
public void generatePDFFromRTFInputStream(java.io.InputStream rtfStream, java.io.OutputStream outputStream, java.awt.print.PageFormat pageFormat)
public void setXMLMode(boolean mode)
public boolean getXMLMode()
public void generatePDFFromPlainTextContent(java.lang.String content, java.io.OutputStream destinationStream, java.awt.print.PageFormat pageFormat)
public void generatePDFFromContent(java.lang.String content, java.io.OutputStream destinationStream, java.lang.String standardPageFormat, java.lang.String orientation)
public void openContentBuffer()
public void appendHTMLContentToContentBuffer(java.lang.String content)
public void appendPlainTextContentToContentBuffer(java.lang.String content)
public void appendDocxToContentBuffer(java.net.URL file)
public void appendDocxToContentBuffer(java.io.File file)
public void appendRTFFileToContentBuffer(java.net.URL file)
public void appendRTFFileToContentBuffer(java.io.InputStream is)
public void appendRTFBase64EncodedStringToContentBuffer(java.lang.String base64EncodedRTFString)
public void appendAlternativeHeaderToContentBuffer(java.lang.String content)
public void addFileAttachmentToContentBuffer(java.lang.String htmlContent, java.net.URL fileAttachment)
public void appendAlternativeFooterToContentBuffer(java.lang.String content)
public void addPageBreakToContentBuffer()
public void closeBufferAndGeneratePDF(java.io.OutputStream destinationStream, java.lang.String standardPageFormat, java.lang.String orientation)
public void closeBufferAndGeneratePDF(java.io.OutputStream destinationStream, java.awt.print.PageFormat pageFormat)
public void closeBufferAndGeneratePDF(java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
public void clearContentBuffer()
public void setReplaceFontFamilyAutomatically(java.lang.String newFontFamily)
public void setDiscardEmptyPages(boolean discard)
public void setFirstPageHeader(java.lang.String content)
public void setHeader(java.lang.String content)
public void setGeneratePageNumbers(boolean generate, java.lang.String text)
public void setDoNotBreakTablesAcrossPages(boolean disablebreak)
public void setDoNotBreakTableRowsAcrossPages(boolean disablebreak)
public boolean isDoNotBreakTableRowsAcrossPages()
public boolean isDoNotBreakTablesAcrossPages()
public void setDoNotBreakListsAcrossPages(boolean disablebreak)
public boolean isDoNotBreakListsAcrossPages()
public void setFooter(java.lang.String content)
public void generatePDFFromContent(java.lang.String content, java.io.OutputStream destinationStream, java.awt.print.PageFormat pageFormat)
public void generatePDFFromContent(java.lang.String content, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
public void generatePDFFromPlainTextContent(java.lang.String content, java.io.OutputStream destinationStream, java.lang.String standardPageFormat, java.lang.String orientation)
public void generatePDFFromPlainTextContent(java.lang.String content, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
public void setPDFAComplianceEnabled(boolean enabled)
public boolean isPDFAComplianceEnabled()
public void setScaleToFitWidth(boolean scale)
public void setMarginsForStandardPageFormat(int top, int bottom, int left, int right)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |