sferyx.administration.pdfgenerator
Class PDFGenerator

java.lang.Object
  extended by sferyx.administration.pdfgenerator.PDFGenerator

public class PDFGenerator
extends java.lang.Object

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

debug

public static boolean debug

replacementFontFamily

public static java.lang.String replacementFontFamily
Constructor Detail

PDFGenerator

public PDFGenerator()
Creates a new instance of PDFGenerator

Method Detail

setTTFFontFolderName

public 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. Please make sure that this feature is enabled by setting the character set to UTF-8


getTTFFontFolderName

public java.lang.String getTTFFontFolderName()

setCharset

public void setCharset(java.lang.String charset)
Set character set for proper pdf generation in non western languages


generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL)
Generates pdf automatically for given URL source. It will display a PageFormat dialog and file dialog for saving the generated file


generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL,
                               java.lang.String destinationFile)
Generates pdf automatically for given URL source. It will display a PageFormat dialog and save the file to the given destination file


generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL,
                               java.lang.String destinationFile,
                               java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given URL source. It generate the file using the given PageFormat and save the file to the given destination file


generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL,
                               java.io.OutputStream destinationStream,
                               java.awt.print.PageFormat pageFormat)
                        throws java.io.FileNotFoundException
Generates pdf automatically for given URL source. It generate the file using the given PageFormat and saves the file to the given OutputStream

Throws:
java.io.FileNotFoundException

generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL,
                               java.io.File destinationFile,
                               java.awt.print.PageFormat pageFormat)
                        throws java.io.FileNotFoundException
Generates pdf automatically for given URL source. It generate the file using the given PageFormat and save the file to the given File

Throws:
java.io.FileNotFoundException

generatePDFFromURL

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromDocxURL

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
Generates pdf automatically for given URL source containing a MS Word Docx file. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat

Throws:
java.io.FileNotFoundException
java.net.MalformedURLException

generatePDFFromDocxURL

public void generatePDFFromDocxURL(java.lang.String sourceURL,
                                   java.io.File destinationFile,
                                   java.awt.print.PageFormat pageFormat)
                            throws java.io.FileNotFoundException,
                                   java.net.MalformedURLException
Generates pdf automatically for given URL source containing a MS Word Docx file. It generate the file using the given PageFormat and save the file to the given File

Throws:
java.io.FileNotFoundException
java.net.MalformedURLException

generatePDFFromRTFURL

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
Generates pdf automatically for given URL source containing Rich Text Format RTF file. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat

Throws:
java.io.FileNotFoundException
java.net.MalformedURLException

generatePDFFromRTFContentBase64String

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given outputStream and page orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromRTFInputStream

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given outputStream and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromRTFURL

public void generatePDFFromRTFURL(java.lang.String sourceURL,
                                  java.io.File destinationFile,
                                  java.awt.print.PageFormat pageFormat)
                           throws java.io.FileNotFoundException,
                                  java.net.MalformedURLException
Generates pdf automatically for given URL source containing Rich Text Format RTF file. It generate the file using the given PageFormat and save the file to the given File

Throws:
java.io.FileNotFoundException
java.net.MalformedURLException

generatePDFFromRTFContentBase64String

public 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. It generates the file using the given PageFormat and save to given OutputStream


generatePDFFromRTFInputStream

public 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. It generate the file using the given PageFormat and save to given OutputStream


setXMLMode

public void setXMLMode(boolean mode)
Sets the XML mode for the renderer - this will define how custom XML tags will be rendered.


getXMLMode

public boolean getXMLMode()
Returns the XML mode for the renderer. The default is false


generatePDFFromPlainTextContent

public void generatePDFFromPlainTextContent(java.lang.String content,
                                            java.io.OutputStream destinationStream,
                                            java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given plain text content. It will generate the file using the given java.awt.print.PageFormat and and save the file to the given OutputStream.


generatePDFFromContent

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given OutputStream and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


openContentBuffer

public void openContentBuffer()
Opens the new content buffer for inserting content to be used for dynamic PDF generation. This should be used in conjuction with closeBufferAndGeneratePDF() and appendContentToContentBuffer(String content).


appendHTMLContentToContentBuffer

public void appendHTMLContentToContentBuffer(java.lang.String content)
Appends new string to existing content buffer. This should be used in conjuction with openContentBuffer() and closeBufferAndGeneratePDF().


appendPlainTextContentToContentBuffer

public void appendPlainTextContentToContentBuffer(java.lang.String content)
Appends the Plain Text string content to the content buffer


appendDocxToContentBuffer

public void appendDocxToContentBuffer(java.net.URL file)
Appends the whole content of the Docx file from the given URL to the content buffer


appendDocxToContentBuffer

public void appendDocxToContentBuffer(java.io.File file)
Appends the whole content of the Docx file from the File to the content buffer


appendRTFFileToContentBuffer

public void appendRTFFileToContentBuffer(java.net.URL file)
Appends RTF file from the URL to the content buffer


appendRTFFileToContentBuffer

public void appendRTFFileToContentBuffer(java.io.InputStream is)
Appends RTF file from the InputStream to the content buffer


appendRTFBase64EncodedStringToContentBuffer

public void appendRTFBase64EncodedStringToContentBuffer(java.lang.String base64EncodedRTFString)
Appends RTF content encoded as Base64 string to the content buffer


appendAlternativeHeaderToContentBuffer

public void appendAlternativeHeaderToContentBuffer(java.lang.String content)
Sets alternative Page Header to be used for the pages to follow - it can contain any HTML formatting. This Page Header will be active until new one is set. If you want to create new page with new Page Header, set the Page Header first using this method and after that add page break. This should be used in conjuction with openContentBuffer() and closeBufferAndGeneratePDF().


addFileAttachmentToContentBuffer

public 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. This method should be used in conjuction with openContentBuffer() and closeBufferAndGeneratePDF().


appendAlternativeFooterToContentBuffer

public void appendAlternativeFooterToContentBuffer(java.lang.String content)
Sets alternative Page Footer to be used for the pages to follow - it can contain any HTML formatting. This Page Footer will be active until new one is set. If you want to create new page with new Page Footer, set the Page Footer first using this method and after that add page break. This should be used in conjuction with openContentBuffer() and closeBufferAndGeneratePDF().


addPageBreakToContentBuffer

public void addPageBreakToContentBuffer()
Adds a page break to the content buffer and all the content appended after that will be on the next page


closeBufferAndGeneratePDF

public 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. This should be used in conjuction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content srings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


closeBufferAndGeneratePDF

public 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. It will generate the file using the given java.awt.print.PageFormat and and save the file to the given OutputStream.


closeBufferAndGeneratePDF

public 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. It will generate the file using the given standardPageFormat sush as A4 etc. and orientation such as Landscape and Portrait and and save the file to the given destinationFile.


clearContentBuffer

public void clearContentBuffer()
Closes the content buffer and clears the content


setReplaceFontFamilyAutomatically

public void setReplaceFontFamilyAutomatically(java.lang.String newFontFamily)
Specifies to automatically replace all font familiy inside the diocument with the sepcified one.


setDiscardEmptyPages

public void setDiscardEmptyPages(boolean discard)
Specifies to automatically discard all pages that do not contain text and are practically a blank pages.


setFirstPageHeader

public void setFirstPageHeader(java.lang.String content)
Generates the first page header for the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered as a header on the pages. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the top margin in order to make enough room for the header if necessary.


setHeader

public void setHeader(java.lang.String content)
Generates the header for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered as a header on the pages. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the top margin in order to make enough room for the header if necessary.


setGeneratePageNumbers

public void setGeneratePageNumbers(boolean generate,
                                   java.lang.String text)
Generates page numbers for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered practically as footer in the pages and will parse the special directive "@#SferyxPDFGenerator-PageNumber#@" in order to place the page number inside the custom formatting. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the top margin in order to make enough room for the page numbering if necessary. Example: <p align=center style="padding-top:30px;border-top:1px solid #0000FF;"><font face="arial" color="blue">Page: @#SferyxPDFGenerator-PageNumber#@</font></p>


setDoNotBreakTablesAcrossPages

public 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. The default value is false


setDoNotBreakTableRowsAcrossPages

public 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. The default value is true


isDoNotBreakTableRowsAcrossPages

public 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. The default value is false and can be set through setDoNotBreakTableRowsAcrossPages


isDoNotBreakTablesAcrossPages

public 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. The default value is false and can be set through setDoNotBreakTablesAcrossPages


setDoNotBreakListsAcrossPages

public 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. The default value is false


isDoNotBreakListsAcrossPages

public 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. The default value is false and can be set through setDoNotBreakListsAcrossPages


setFooter

public void setFooter(java.lang.String content)
Generates the footer for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered as a footer on the pages. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the bottom margin in order to make enough room for the footer if necessary.


generatePDFFromContent

public void generatePDFFromContent(java.lang.String content,
                                   java.io.OutputStream destinationStream,
                                   java.awt.print.PageFormat pageFormat)
Generates pdf automatically for given html content. It will generate the file using the given java.awt.print.PageFormat and and save the file to the given OutputStream.


generatePDFFromContent

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromPlainTextContent

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given OutputStream and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromPlainTextContent

public 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. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


setPDFAComplianceEnabled

public 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")


isPDFAComplianceEnabled

public boolean isPDFAComplianceEnabled()
Returns whether the PDF/A standard compliance is enabled or not.


setScaleToFitWidth

public void setScaleToFitWidth(boolean scale)
Indicates whether to rescale the page in order to fit the give PageFormat - the default is true


setMarginsForStandardPageFormat

public 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


main

public static void main(java.lang.String[] args)