Convert easily Rich Text Format RTF to PDF in your Java applications

Sferyx JSyndrome PDF Generator and Converter


Advanced Java PDF Generator and Converter component - convert easily Rich Text Format RTF files to PDF and PDF/A.

Sferyx PDF Generator Component is powerful Java Rich Text to PDF Converter and Generator component. It converts easily Rich Text Format RTF files to PDF in any Java Application - Swing, JavaFX, SWT Eclipse and also Oracle Forms and produces perfectly paginated documents. With only a few lines of code is possible to generate complex PDF files from practically any source or location and the resulting PDF can be written in a file, OutputStream or shown inside the PDF viewer. Supports all UTF-8 languages including support for Greek, Arabic, Cyrillic, Hebrew, Farsi, Chinese, Japanese, Hindi, Tamil and more.

You can create the files dynamically by adding the content on-the-fly directly inside your application with only a few lines of code and also generate page breaks, headers, footers and page numbers when needed.

 

All Sferyx products are signed with  
Trusted Code Signing Security Certificate

Download Sferyx PDFGenerator Component Java RTF to PDF Order Sferyx PDFGenerator Component Java RTF to PDF
Version 23.0

Sferyx JSyndrome PDF Generator Component Edition : Download Sferyx PDFGenerator - PDFGeneratorDemo.zip
 
 

 

  • Pure Java Rich Text to PDF Generation engine - allows fast and easy PDF creation from various sources and also convert even very complex Rich Text RTF documents in Java  with single line of code - 100% in house development - it does not depend on external packages.
  • It converts and generates quickly and easily PDF and PDF/A files directly from HTML, Plain Text, Microsoft Word Docx, Rich Text Format RTF, JPEG, GIF, PNG, BMP
  • Royalty free redistribution with your applications
  • Automatic multiple page layout, rendering and inclusion of all images including the inline Base64 encoded images, inline and linked CSS styles etc.
  • Possibility to specify the desired Page format and margins and whether to scale the content to fit inside or not
  • Works with any JRE/ JDK 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or higher
  • Support for Oracle Forms and full generation of PDF from Oracle Forms and CLOB 
  • Fully compatible with Swing, JavaFX, SWT/Eclipse, Oracle Forms, Java Servlets, JSP
  • Support for all western Latin languages such as English, German, French, Italian, Spanish, Portuguese, Swedish, Norwegian etc.
  • Support for Arabic, Cyrillic, Greek, Hebrew, Farsi, Hindi, Tamil and many other languages through  UTF-8 pdfGenerator.setCharset("utf-8") character set encoding and Chinese language is also supported through the code: pdfGenerator.setCharset("ISO-10646-UCS-2")
  • Automatic embedding of all TTF fonts contained inside the document when the UTF-8 encoding is set using the code: pdfGenerator.setCharset("utf-8")
  • Support for PDF/A file specification when pdfGenerator.setCharset("utf-8") is set.
  • Compatible with Headless mode for server systems
  • Compact size and fast document generation
  • Possibility to specify whether to split the pages automatically or to generate a poster-like one page PDF file with automatically determining the page length to fit the content.
  • You can specify Headers, Footers and Page numbers in any formatting and position through full HTML formatting support.
  • Now all hyperlinks inside the HTML document are generated as links (annotations) automatically into the resulting PDF file
  • Support for disabling the table breaking across multiple pages
  • Support for disabling lists breaking across multiple pages
  • Support for the CSS page break elements page-break-before:always, page-break-after:always, page-break-inside:never

 

Example usage


The use of the PDFGenerator component is quite simple - with only a few lines of code is possible to generate and convert practically any document to PDF and add headers, footers, page numbers etc.

If your document contains special fonts, characters or symbols you should set the characters set to UTF-8 using the following method - pdfGenerator.setCharset("utf-8"); - this will also generate PDF/A compliant file. Here are some examples:

Generate PDF automatically from Rich Text Format RTF URL

It will generate the PDF file using the standard page format string such as "A4", "Letter" etc. and and save the file to the specified OutputStream or File and page orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat. The destinationFile parameter is a java.io.File object:

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setMarginsForStandardPageFormat (10,10,10,10);
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFURL ("http://your_url_here.rtf", destinationFile, "Letter", "Portrait");

or using the file name as String:

 

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setMarginsForStandardPageFormat (10,10,10,10);
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFURL ("http://your_url_here.rtf", "c:/pdfgenerator-test1.pdf", "A4", "Portrait");

Generate PDF automatically from RTF content from URL to OutputStream

It will generate the PDF file using the standard page format string such as "A4", "Letter" etc. and and save the file to the specified OutputStream and page orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat. This method will recognize automatically if document is html, docx, rtf, txt or image and will convert it accordingly. To use this automatic conversion the URL must end with the corresponding extension like docx, txt, rtx, jpeg, gif, png etc.

If you need you can use also OutputStream if necessary to save the resulting PDF file:

 

pdfGenerator.generatePDFFromURL ("http://your_url_here/file.rtf", destinationStream, "Letter", "Portrait");


If you want to include automatically all TTF fonts inside the PDF/A document or you are using non western languages or special characters you should use the following method:

 

pdfGenerator.setCharset ("utf-8");


For generation of documents in Chinese language use the following setting:

 

pdfGenerator.setCharset ("ISO-10646-UCS-2");

Generate PDF automatically from RTF content from InputStream and Base64 encoded String

This method will generate the PDF file from RTF source using the standard page format string such as "A4", "Letter" etc. and and save the file to the specified OutputStream and page orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setMarginsForStandardPageFormat (10,10,10,10);
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFURL ("http://your_url_here.rtf", destinationFile, "Letter", "Portrait");

public void generatePDFFromRTFContentBase64String(String rtfString, OutputStream outputStream,String standardPageFormat, 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 will save it 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

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setMarginsForStandardPageFormat (10,10,10,10);
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFContentBase64String ("e1xydGYxXGFuc2lcZGVmZjBccGFyIFRoaXMgaXMgYmFzZTY0ZW5jb2RlZCBSVEYgU3RyaW5nXHBhcn0=", outputStream, "Letter", "Portrait");

public void generatePDFFromRTFContentBase64String(String rtfString, OutputStream outputStream, java.awt.print.PageFormat pageFormat)

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 will save it the file to the given outputStream and page orientation such as "Portrait" or "Landscape".

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFContentBase64String ("e1xydGYxXGFuc2lcZGVmZjBccGFyIFRoaXMgaXMgYmFzZTY0ZW5jb2RlZCBSVEYgU3RyaW5nXHBhcn0=", outputStream, pageFormat);

public void generatePDFFromRTFInputStream(InputStream inputStream, OutputStream outputStream,String standardPageFormat, 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

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setMarginsForStandardPageFormat (10,10,10,10);
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFInputStream (inputStream, outputStream, "Letter", "Portrait");

public void generatePDFFromRTFInputStream(InputStream inputStream, OutputStream outputStream, java.awt.print.PageFormat pageFormat)

Generates PDF automatically for given RTF InputStream containing Rich Text Format RTF. It generates the file using the given PageFormat and saves it to given OutputStream.

import sferyx.administration.pdfgenerator.*;

PDFGenerator pdfGenerator=new PDFGenerator();
pdfGenerator.setCharset ("utf-8"); Will embed all fonts and generate PDF/A compliant file and will add support for non-latin languages.
pdfGenerator.generatePDFFromRTFInputStream (inputStream, outputStream, pageFormat);

Generate or convert PDF automatically from RTF content URL source and different Page Dialog options


Generates or converts PDF automatically for the URL source. It will display a PageFormat dialog and file dialog for saving the generated file. This method will recognize automatically if document is html, docx, rtf, txt or image and will convert it accordingly. To use this automatic conversion the URL must end with the corresponding extension like docx, txt, rtx, jpeg, gif, png etc. 

pdfGenerator.generatePDFFromURL ("http://your_url_here/file.rtf");


It will display a PageFormat dialog and save the file to the specified destination file. This method will recognize automatically if document is html, docx, rtf, txt or image and will convert it accordingly. To use this automatic conversion the URL must end with the corresponding extension like docx, txt, rtx, jpeg, gif, png etc.   

pdfGenerator.generatePDFFromURL ("http://your_url_here/file.rtf","c:/pdfgenerator-test1.pdf");


Generates or converts PDF automatically for the URL source. It will generate the file using the given java.awt.PageFormat and save the file to the given destination file. This method will recognize automatically if document is html, docx, rtf, txt or image and will convert it accordingly. To use this automatic conversion the URL must end with the corresponding extension like docx, txt, rtx, jpeg, gif, png etc.   

 

pdfGenerator.generatePDFFromURL ("http://your_url_here/file.rtf", "c:/pdfgenerator-test1.pdf", new java.awt.PageFormat());

 

Generates or converts PDF automatically for the  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 orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat

 

pdfGenerator.generatePDFFromRTFURL ("http://your_url_here/file.rtf", "c:/pdfgenerator-test1.pdf", "A4", "Portrait");

or

pdfGenerator.generatePDFFromURL ("http://your_url_here/file.rtf", "c:/pdfgenerator-test1.pdf", "Letter", "Landscape");

Generate Header for each page in the PDF document

For DOCX and RTF documents the First Page Header and First Page Footer and all Headers and Footers will be retrieved automatically from the document. You can override these headers and footers using the methods here below.

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 include 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.  If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed.

pdfGenerator.setHeader ("<h1 style=\"color:red;background-color:yellow;border:1px solid blue;\">This is a Header - you can put any HTML here</h1>");

Generate Header with Page Numbers for each page in the PDF document

pdfGenerator.setHeader ("<h1 style=\"color:red;background-color:yellow;border:1px solid blue;\">This is a Header - you can put any HTML here</h1><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@</font> - you can put any HTML here </p>");

If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - an example of the usage is here below:

pdfGenerator.setHeader ("<h1 style=\"color:red;background-color:yellow;border:1px solid blue;\">This is a Header - you can put any HTML here</h1><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@ of pages: <b>@#SferyxPDFGenerator-TotalPagesNumber#@</b></font> - you can put any HTML here </p>");

Generate First Page Header for the first page of the PDF 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 include 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.  If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed.

pdfGenerator.setFirstPageHeader ("<h1 style=\"color:red;background-color:yellow;border:1px solid blue;\">This is the First Page Header - you can put any HTML here</h1>");

Generate First Page Header with Page Numbers and Total Pages for the PDF document

pdfGenerator.setFirstPageHeader ("<h1 style=\"color:red;background-color:green;border:1px solid blue;\">This is the First Page Header - you can put any HTML here</h1><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@</font> - you can put any HTML here </p>");

If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - an example of the usage is here below:

pdfGenerator.setFirstPageHeader ("<h1 style=\"color:red;background-color:green;border:1px solid blue;\">This is the First Page Header - you can put any HTML here</h1><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@ of pages: <b>@#SferyxPDFGenerator-TotalPagesNumber#@</b></font> - you can put any HTML here </p>");

Generate 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 include 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. If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed.

pdfGenerator.setFooter ("<h3 style=\"color:blue;background-color:yellow:border-top:2px solid green;\">This is a Footer - you can put any HTML here </h3>");

Generate Footer with Page Numbers for each page in the document

pdfGenerator.setFooter ("<h3 style=\"color:blue;background-color:yellow:border-top:2px solid green;\">This is a Footer - you can put any HTML here </h3><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@</font> - you can put any HTML here </p>");

If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - an example of the usage is here below:

pdfGenerator.setFooter ("<h3 style=\"color:blue;background-color:yellow:border-top:2px solid green;\">This is a Footer - you can put any HTML here </h3><p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@ of pages: <b>@#SferyxPDFGenerator-TotalPagesNumber#@</b></font> - you can put any HTML here </p>");

 

Specifies to automatically discard all pages that do not contain text and are practically a blank pages.



pdfGenerator.setDiscardEmptyPages (true);

Generate 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 include 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.

 

pdfGenerator.setGeneratePageNumbers(true,"<p align=center style=\"padding-top:30px;border-top:1px solid #0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@ of total pages <b>@#SferyxPDFGenerator-TotalPagesNumber#@</b></font> - you can put any HTML here </p>");

Avoid breaking tables across the pages when possible in the PDF document

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

pdfGenerator.setDoNotBreakTablesAcrossPages (true);

Avoid breaking tables rows across the pages when possible in the PDF document

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 false

pdfGenerator.setDoNotBreakTableRowsAcrossPages (true);

Avoid breaking lists across the pages when possible in the PDF document


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

 

pdfGenerator.setDoNotBreakListsAcrossPages (boolean disablebreak);

Command line arguments for the PDFGenerator.jar file

You can easily execute the PDFGenerator.jar from the command line and perform document conversions without writing code using the available command line arguments as follows:

Usage:
java -jar PDFGenerator.jar absolute_url destination_file [page_format] [page_orientation] [character_set]

Example:
C:\test>java -jar "C:\test\PDFGenerator.jar" http://your_url_here c:/test/test-html.pdf A4 Portrait utf-8

 

 

Package sferyx. administration. pdfgenerator

Fully featured easy-to-use PDF Generator from HTML and plain text content

Class Summary

CustomPageFormatThis class provides a simplified way for assigning standard page formats
PDFGeneratorGeneral purpose PDF Generator - this class provides fully featured generation of PDF files from various sources containing HTML, Word Docx, images or plain text content.
PDFGeneratorOracleBeanThis class has been optimized to deliver correct generation of Rich Text content for Oracle Reports and provide general PDF generation capabilities for OracleForms.
 

 

Method Summary

 void addFileAttachmentToContentBuffer(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().
 void addPageBreakToContentBuffer()
          Adds a page break to the content buffer and all the content appended after that will be on the next page
 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 conjunction with openContentBuffer() and closeBufferAndGeneratePDF().
 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 conjunction with openContentBuffer() and closeBufferAndGeneratePDF().
 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 (String htmlContent, java.io.OutputStream destinationStream, String standardPageFormat, String orientation)
          Generates PDF automatically for given html content.
 void generatePDFFromContent (String htmlContent, java.io.OutputStream destinationStream,  java.awt.print.PageFormat pageFormat)
          Generates PDF automatically for given html content.
 void generatePDFFromContent (String htmlContent, String destinationFile, String standardPageFormat, String orientation)
          Generates PDF automatically for given html content.
 void generatePDFFromPlainTextContent (String content, java.io.OutputStream destinationStream, String standardPageFormat, String orientation)
          Generates pdf automatically for given text content.
 void generatePDFFromPlainTextContent (String content, java.io.OutputStream destinationStream,  java.awt.print.PageFormat pageFormat)
          Generates pdf automatically for given text content.
 void generatePDFFromPlainTextContent (String content, String destinationFile, String standardPageFormat, String orientation)
          Generates PDF automatically for given text content.
 void generatePDFFromURL (String sourceURL)
          Generates PDF automatically for given URL source.
 void generatePDFFromURL (String sourceURL, java.io.File destinationFile, java.awt.print.PageFormat pageFormat)
          Generates PDF automatically for given URL source.
 void generatePDFFromURL (String sourceURL, java.io.OutputStream destinationStream, java.awt.print.PageFormat pageFormat)
          Generates pdf automatically for given URL source.
 void generatePDFFromURL(String sourceURL, String destinationFile)
          Generates PDF automatically for given URL source.
 void generatePDFFromURL(String sourceURL, String destinationFile, java.awt.print.PageFormat pageFormat)
          Generates PDF automatically for given URL source.
 void generatePDFFromURL (String sourceURL, String destinationFile, String standardPageFormat, String orientation)
          Generates PDF automatically for given URL source.
void public void generatePDFFromRTFContentBase64String(String rtfString, OutputStream outputStream,String standardPageFormat, 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 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
void public void generatePDFFromRTFContentBase64String(String rtfString, OutputStream outputStream, java.awt.print.PageFormat pageFormat) - Generates PDF automatically for given RTF base64 encoded string containing Rich Text Format content. It will generate the file using the given java.awt.print.PageFormat pageFormat and save the file to the given outputStream.
void generatePDFFromRTFInputStream(InputStream inputStream, OutputStream outputStream,String standardPageFormat, 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 orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat.
void generatePDFFromRTFInputStream(InputStream inputStream, 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.
void public void generatePDFFromDocxURL (String sourceURL, String destinationFile,String standardPageFormat, String orientation) throws 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 orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat
void public void generatePDFFromDocxURL (String sourceURL, File destinationFile, java.awt.print.PageFormat pageFormat) throws 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
void public void generatePDFFromRTFURL (String sourceURL, String destinationFile,String standardPageFormat, String orientation) throws 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 orientation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat
void public void generatePDFFromRTFURL (String sourceURL, File destinationFile, java.awt.print.PageFormat pageFormat) throws 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
 void

setCharset(String charset)
          Set character set for proper PDF generation in non western languages - for all languages use UTF-8 - it will embed all fonts inside the PDF and will generate PDF/A files. For Chinese use ISO-10646-UCS-2

 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")
 boolean isPDFAComplianceEnabled()
          Returns whether the PDF/A standard compliance is enabled or not.
 void setScaleToFitWidth (boolean scale)
          Indicates whether to rescale the page in order to fit the given PageFormat - the default is true
void setHeader (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. If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed. If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - see the provided examples for major details.
void setFirstPageHeader (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. If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed. If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - see the provided examples for major details.
void setFooter (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. If you wish to include also page numbers it is sufficient to include the @#SferyxPDFGenerator-PageNumber#@ directive anywhere inside your HTML content - it will be parsed automatically and displayed. If you need to include also the total page number, then you should use the following directive inside the HTML content: @#SferyxPDFGenerator-TotalPagesNumber#@ - see the provided examples for major details.
void setDiscardEmptyPages (boolean discard)
 
          Specifies to automatically discard all pages that do not contain text and are practically a blank pages.
void setTTFFontFolderName (String folderName)  - sets the absolute path to the folder which contains the TrueType fonts to be used when generating the PDF documents. Please make sure that this feature is enabled by setting the character set to UTF-8
String getTTFFontFolderName() - returns the name of the True Type fonts if previously set. Otherwise it will return null and for the generation of the PDF files will be used the system font folders.
void setDoNotBreakListsAcrossPages (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 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.
boolean isDoNotBreakListsAcrossPages() returns whether the PDFGenerator should not allow to the lists to break across the pages
boolean isDoNotBreakTablesAcrossPages() returns whether the PDFGenerator should not allow to the tables to break across the pages
void setGeneratePageNumbers (boolean generate, 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>
 
 

Customers

Sferyx customer base counts more than 1000 corporate customers and institutions from over 40 countries and different industrial sectors as follows: Media and publishing companies, Internet Service Providers, Research  Labs, Fortune 500 companies, Universities, Colleges and Schools, Software Developers, Content Management Systems developers, Web design agencies.

More than 1000 corporate customers, among them:

 

| Home | Users Manual | LicenseDemo & Download

Copyright © 2001-2024 Sferyx Srl. All rights reserved. Sferyx and the Sferyx logo are registered trademarks of Sferyx Srl. http://www.sferyx.com