HTML EDITOR COMPONENT

User Manual
Oracle Forms
SWT / Eclipse
XML features
FAQ
Download
Screenshots
Licensing & Prices

HTML EDITOR APPLET

User Manual
FAQ
Drupal Integration
SAKAI Integration
IBM Lotus Notes
Download
Screenshots
Licensing & Prices

PDF GENERATOR

User Manual
Oracle Forms
Licensing & Prices

EQUATION/MATHML EDITOR

User Manual
FAQ
Download
Screenshots
Licensing & Prices

PDFEXPORT ADD-ON

User Manual
On-line store
Customers
Contacts


PDF Generator Oracle Forms Integration manual - create PDF documents from HTML, Text, Docx, RTF or CLOB
 

1. Can I generate multipage Rich Text PDF documents in Oracle Forms from CLOB fileds or URL or HTML, Docx, RTF, TXT, JPEG, PNG, GIF, BMP and plain text files?

Yes, the Sferyx PDF Generator for Oracle Forms allows extremely simple generation of fully formatted and paged PDF documents directly from your Oracle Form. It can be configured to generate even very large files direclty from CLOB filed or from a given URL or local files from HTML, Plain text, MS Word Docx, Rich Text Format RTF, JPEG, GIF, PNG, BMP and other. Please see the examples below on how this can be done. You can also automate the whole preocess through PL/SQL scripts. Here are the main functionalities:

Version 23.0
Download PDFGenerator Component

Sferyx JSyndrome PDF Generator Component Edition :
PDFGeneratorDemo.zip
(ZIP file, ~ 0.9 MB)
  • Pure Java PDF Generation engine - allows fast and easy PDF generation from various sources and even from very complex HTML/XHTML documents with single line of code - 100% in house development - it does not depend on external packages.
  • Automatic multiple page layout, rendering and inclusion of all images, inline and linked styles
  • 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
  • Fully compatible with Swing, SWT/Eclipse, Oracle Forms
  • 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 character set encoding and separately Chinese language is also supported through the code: pdfGenerator.setCharset("utf-8")
    or in Oracle Forms:
    FBEAN.ADD_ARG(hArgs,'utf-8');
    FBEAN.INVOKE('block_control.PDFGenerator', 1, 'setCharset', hArgs);
  • Automatic embedding of all TTF fonts contained inside the document when the UTF-8 encoding is set - by using the code: pdfGenerator.setCharset("utf-8")
    or in Oracle Forms:
    FBEAN.ADD_ARG(hArgs,'utf-8');
    FBEAN.INVOKE('block_control.PDFGenerator', 1, 'setCharset', hArgs);
  • 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

2. How can I integrate the PDF Generator in Oracle Forms?

As any other java bean is integrated in Oracle Forms designer. Place the jar file in the designer's classpath and it will be automatically detected by the Oracle Forms Designer. You can add it after that easily as a bean area.

  • copy the PDFGenerator.jar file in the <ORACLE_HOME> /forms/java directory
  • edit your /forms/server/formsweb.cfg file to add the PDFGenerator.jar as follows:
    # Forms applet archive setting for JInitiator
    archive_jini=f90all_jinit.jar,PDFGenerator.jar
    # Forms applet archive setting for Microsoft Internet Explorer native JVM
    archive_ie=f90all.cab,PDFGenerator.jar
    # Forms applet archive setting for other clients (Sun Java Plugin, Appletviewer, etc)
    archive=f90all.jar,PDFGenerator.jar
  • open the PDFGenerator-reports-example.fmb module (Oracle Forms module)
  • compile all and run the module
  • Into the Oracle Forms Visual designer insert a Bean area and set the implementation property to sferyx.administration.pdfgenerator.PDFGeneratorOracleBean

3. Available methods accessible directly from the sferyx.administration. pdfgenerator. PDFGeneratorOracleBean - you should use the same rules for accessing those methods as described above in the OracleForms PL/SQL script examples:

public void generatePDF(java.lang.String sourceURL, java.lang.String destinationFile) -Generates a pdf file from given URL and saves it to a given filename using default paper size and orientation

publiv void generatePDFFromContent(java.lang.String content, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation) - Generates a pdf file from given html/text content and saves it to a given filename, using paper size and paper orientation such as LANDSCAPE or PORTRAIT

public void generatePDFFromReport(java.lang.String sourceURL, java.lang.String standardPageFormat, java.lang.String orinetation) - Generates a pdf file from given URL and saves it to temporary file showing the ready PDF document into the available PDF viewer

public void generatePDFFromURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation) - Generates a pdf file from given URL and saves it to a given filename using paper size and orientation

public void generatePDFFromRTFURL(String sourceURL, String destinationFile,String standardPageFormat, String orientation) - 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

public void generatePDFFromDocxURL(String sourceURL, String destinationFile,String standardPageFormat, String orientation) - 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

public void addReportParameter(java.lang.String name, java.lang.String value) - Adds parameters to be used for generation of the report - this method can be used multiple times to add multiple parameters. Please note that this is persistent and once added the parameters will be used until cleared. See clearReportParameters method.

public void clearReportParameters() - Clears all the report parameters set previously using addReportParameter.

public void openContentBuffer() - Opens the new content buffer for inserting content inside the PDF Generator. This should be used in conjunction with closeBufferAndGeneratePDF() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms.

public void appendContentToContentBuffer(String content) - Appends new string to existing content buffer. This should be used in conjunction with openContentBuffer() and closeBufferAndGeneratePDF(). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms.

public void closeBufferAndGeneratePDF(String destinationFile,String standardPageFormat, String orinetation) - Closes the existing content buffer and inserts its content inside the PDF Generator. This should be used in conjunction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms.

OR

public String closeBufferAndGenerateTempPDFFile(String standardPageFormat, String orinetation) - Closes the existing content buffer and inserts its content inside the PDF Generator and generates a temporary file where the PDF file is saved - the name of the temp file is returned as a result from the method. This should be used in conjunction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.

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

public void setOpenGeneratedFileInPDFViewer(boolean show) - Indicates whether to automatically open the default PDF Viewer and show the generated file or not. The default is true

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

public void setCharset(String charSet) - Sets the character set to be used. The default one is supporting the majority of the western latin languages. If you would like to support any other language you must specify "utf-8" as character set to be used - this will cause also all the TTF fonts used inside the document to be embedded into the resulting PDF file.

public 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.

public 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.

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

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

public void setTTFFontFolderName(java.lang.String folderName) - sets 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

public java.lang.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 list elements when page break is encountered if the list 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.

java.lang.String closeBufferAndGeneratePDFSynchronously(java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation) - closes the existing content buffer and inserts its content inside the PDF Generator.

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

Here is also some simple example on how to use the content buffer for generating large PDF documents in Oracle Forms:

FBEAN.INVOKE('block_control.PDFGenerator', 1, 'openContenBuffer');
FBEAN.ADD_ARG(hArgs, :block_control.description1);
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'appendContentToContentBuffer', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);
FBEAN.ADD_ARG(hArgs, :block_control.description2);
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'appendContentToContentBuffer', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);
FBEAN.ADD_ARG(hArgs, :block_control.description3);
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'appendContentToContentBuffer', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);
FBEAN.ADD_ARG(hArgs, :block_control.description4);
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'appendContentToContentBuffer', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);
FBEAN.ADD_ARG(hArgs, :block_control.description5);
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'appendContentToContentBuffer', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);

FBEAN.ADD_ARG(hArgs, 'c:\test.pdf');
FBEAN.ADD_ARG(hArgs,'Letter');
FBEAN.ADD_ARG(hArgs,'PORTRAIT');
FBEAN.INVOKE('block_control.PDFGenerator', 1, 'closeBufferAndGeneratePDF', hArgs);
FBEAN.CLEAR_ARGLIST(hArgs);

 

4. Data transfer from CLOB to PDFGenerator and generation of the pdf file

This example uses some table names and columns which you will need to adapt the query in the example to your environment or create the same tables

INSERT INTO PDFGENERATOR FROM CLOB AND GENERATE THE PDF FILE



DECLARE
    bean varchar2(200):='PDFGENERATOR_AREA';
    t_id number(20):=1;
  hArgs FBEAN.ARGLIST;
  parts number(20);
  part varchar2(32500);
  part_size number(20) := 1000;
  body_length number(20);
BEGIN

  hArgs := FBEAN.CREATE_ARGLIST;

       -- Init PDFGenerator Buffer
      FBean.Invoke(bean,1,'openContentBuffer');
     
      -- Get CLOB content lenght    
      select nvl(dbms_lob.getlength(ASSUMPTION_DESC),0) into body_length from EPM_CONTRACT_CONS where EMP_NO = t_id;
     
         
     if body_length > 0 then
        -- Get Length and number of the parts
        select trunc(dbms_lob.getlength(ASSUMPTION_DESC)/ part_size) +1 into parts from EPM_CONTRACT_CONS where EMP_NO = t_id;
       
        for i in 1..parts loop
            select dbms_lob.substr(ASSUMPTION_DESC,part_size,((i-1)*part_size)+1) into part from EPM_CONTRACT_CONS where EMP_NO = t_id;
           
          hArgs := FBEAN.CREATE_ARGLIST;
             FBEAN.ADD_ARG(hArgs,part);
          FBean.Invoke(bean,1,'appendContentToContentBuffer',hArgs);
        end loop;
      
      end if;

      -- Populate the PDFGenerator and generate the file
      FBean.CLEAR_ARGLIST(hArgs);
            FBean.ADD_ARG(hArgs, 'c:\test-new.pdf');
            FBean.ADD_ARG(hArgs,'Letter');
            FBean.ADD_ARG(hArgs,'PORTRAIT');
            FBean.Invoke(bean, 1, 'closeBufferAndGeneratePDF', hArgs);
END;

 

5. Screen illustrating the setting of the properties inside the Oracle Forms builder

You can note on the screenshot  below the bean implementation property of the Bean Area is set to sferyx. administration. pdfgenerator. PDFGeneratorOracleBean:

Oracle Forms PDF Generator


6. Can I generate full Rich Text Oracle Reports with the PDF Generator in Oracle Forms?

The Sferyx PDF Generator for Oracle Forms is a new product which resolves exactly this problem - it allows a fully formatted rich text generation of Oracle Reports in PDF from Oracle forms - it is capable of rendering everything inside the report - images, text, tables, lists - anything done automatically and exported in PDF. It works with all existing oracle reports and oracle forms and is quite simple to use. Furthermore you can use it to generate any kind of PDF documents directly from Oracle Forms using the available API.

7. How to generate a report with the PDF Generator in Oracle Forms?

You can generate easily full rich text reports from existing Oracle Reports by following the examples and the guidelines below:

The PDFGenerator gives you the possibility to create PDF files from existing reports by supplying the report URL as a parameter to the PDFGenerator which has been embedded inside an sample Oracle Form.

Declare
hArgs FBEAN.ARGLIST;
Begin
hArgs:=FBEAN.CREATE_ARGLIST;
FBEAN.ADD_ARG(hArgs, 'http://'||host||'/reports/rwservlet?'||report_string);
FBEAN.ADD_ARG(hArgs,'Letter');
FBEAN.ADD_ARG(hArgs, 'PORTRAIT');
FBean.Invoke('PDFGENERATOR_AREA', 1, 'generatePDFFromReport', hArgs);

please consult the available examples in the folder "examples/oracleforms" for major details.

There are the following cases when generating reports with the PDFGenerator:

  1. If your report contains HTML fields which fit inside single page then you can preserve their formatting in the following way:

1) In the Oracle Reports Builder, for the field containing the HTML code you should set the property "Contains HTML Tags" to "NO"

2) In the Oracle Reports Builder, for the field containing the HTML code you should set the property "CSS Class Name" - "sferyx_pdf_generator" - please write this as you see it in small case without trailing spaces.

After that you can generate the report as specified in the examples.

  1. If your report contains HTML fields which span through multiple pages then you can preserve the formatting in the following way:

1) Use the method generatePDFFromURL instead of generatePDFFromReport
The argument format for this method is this: generatePDFFromURL(URL, "c:/test1.pdf", "Letter", "PORTRAIT"); or one of its variations

2) At the end of the URL pointing to the report, you should append the parameter &pagesize=8.5x512 so it becomes something like
'http://'||host||'/reports/rwservlet?'||report_string||'&pagesize=8.5x512'.

where report_string is as follows:

report_string:='report='||:report_name||'&userid='||user_name||'/'||pass_word||'@'||d_base||'&execution_mode=batch&comm_mode=synchronous
&destype=cache&desformat=HTMLCSS';



3) Use the following method to discard the eventual blank pages
public void setDiscardEmptyPages(boolean discard) - Specifies to automatically discard all pages that do not contain text and are practically blank pages.

If you experience difficulties in configuring the parameters specified above, do not hesitate to contact support@sferyx.com for further help.

If you need major flexibility and control over the PDF generation you can consult the various methods available below in order to construct the necessary content and PDF files dynamically.

 

Our Services and assistance

All Sferyx products are assured with continuous e-mail support. With the retail products is included in the price 30 days startup support. Additionally, you can purchase annual support subscription tickets from our web store.

Sferyx offers also a wide range of customization services for its products in order to satisfy any customer requirement. We can adapt our products to fit the customer needs and any kind of integration requirements. We execute also express developments, customization under request, development of new features on demand. You can request a quote at sales@sferyx.com or support@sferyx.com indicating your requirements and the terms of delivery.

 

 


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