No announcement yet.

VVPDF - vvPDdf.addHTML

  • Filter
  • Time
  • Show
Clear All
new posts

  • VVPDF - vvPDdf.addHTML

    I see this is part of the vvPdf service program, but unfortunately not documented nor any examples..

    can this be used ?

    we would like to create a document with F.e a header doc that consists of a logo (on the left , a title center, and a date on the right alignment

    but cannot seem to make this work with the supplied pdf-procedures..

    is this the correct way or is there another way to create pdf's directly from within RPG.

  • #2
    Hi Thierry,

    The addHTML procedure might work for what you're trying to do. It was a bit of an experiment, hence not documented (yet). But you should be able to use it provided you add [ROOT_PATH]java/cnxpdf.jar to your Portal Admin > Settings > Java CLASSPATH setting.

    We'll add an example program for vvPDF_addHTML to the next build. Here's what it will look like:
          /copy qcpylesrc,vvHspec                                                  
         ** --------------------------------------------------------------        
         **         Copyright (C) 2008-2019 CNX Corporation                        
         ** --------------------------------------------------------------        
         **     Object ID: EXPDF04                                                
         **       Version: V5.2                                                    
         **   Description: Valence Examples - PDF - using addHTML procedure        
         ** --------------------------------------------------------------        
         **  d specs                                                              
         d pdfDoc          s                   like(document)                      
         d html1           s          65535a   varying                            
         d html2           s          65535a   varying                            
         d htmlfld         s             40a                                      
          /define includePDF                                                      
          /copy qcpylesrc,vvDspec                                                  
         **  program start                                                        
           // specify the full name and path of the PDF document you wish to create
           // create the PDF document object                                                        
           pdfDoc = vvPdf_newDocument(vvPDF);                                                        
           // create a sample html string.                                                          
           html1 = '<html><body><h1>Example Heading<h1></body>/html>';                            
           // pass the PDF document and the html string to render the html inside the PDF document.  
           vvPdf_addHTML(pdfDoc: html1);                                                            
           // create a variable to be added to the html string.                                      
           htmlfld = '555 Main St.';                                                                
           html2 = '<html><body><h1>Address is: ' + htmlfld +                                        
           // pass the PDF document and the html string to render the additional html in the document.
           vvPdf_addHTML(pdfDoc: html2);                                                            
           // close the document                                                                    
    Let us know how it works out!
    Last edited by robert.swanson; 06-15-2019, 06:05 AM.