Henrik_Lehnert Contributor.
Contributor.
275 views

C$PDF / jpg image

Hi 

I am trying the new function "C$PDF" for runtime 10.2

I am trying to add a jpg image to a pdf file - but I am having trouble.

When executing I get an error: Invalid or missing parameter to "C$PDF" using hpdf-page-drawimage

Is there anyone who can see what I'm doing wrong ?!

 

identification division.
program-id. pdf.
 
*    Create a PDF file using "c$pdf" routine. Insert jpg image.
*    Runtime version 10.2.0 or newer is necessary !
         
environment division.
                    
data division.                                             
             
working-storage section.
01      file-data            pic x(24).
01      file-status          pic s9(2).
 
copy "cpdf.def".
    
procedure division.
main section.
        
*    Check if image exists
 
      move "image.jpg" to hpdf-jpeg-filename
 
      call "c$fileinfo" using  hpdf-jpeg-filename file-data
                             giving file-status
      end-call
 
      if file-status not = 0
         display message "File doesn't exists: "
                                  hpdf-jpeg-filename
                                  icon 3
      end-if
                       
*    Create new document
                     
      call "c$pdf" using  hpdf-new
                                 hpdf-user-data
                       giving hpdf-doc
      end-call
 
*    Load jpeg image
 
      call "c$pdf" using  hpdf-loadjpegimagefromfile
                                 hpdf-doc
                                 hpdf-jpeg-filename
                        giving hpdf-jpeg-image
      end-call

*    Add new page
 
      call "c$pdf" using  hpdf-addpage
                                 hpdf-doc
                        giving hpdf-page
      end-call
 
*    Draw jpeg image
     
      call "c$pdf" using  hpdf-page-drawimage | <-- ERROR
                                 hpdf-page
                                 hpdf-jpeg-image
                                 1   | x
                                 1   | y
                                 100 | width
                                 100 | height
      end-call
     
*    Save to file (overwrite if it already exists)
 
      move "image.pdf" to hpdf-savefilename
 
      call "c$pdf" using  hpdf-savetofile
                                 hpdf-doc
                                 hpdf-savefilename
      end-call
 
*    Cleanup
          
      call "c$pdf" using  hpdf-free
                                 hpdf-doc
      end-call 
       .
 
main-exit.
       goback.
 
end program.
 
0 Likes
1 Reply
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

RE: C$PDF / jpg image

Good morning.

This is a known issue in 10.2.0, where the initial version of C$PDF could load image files from disk,

but could not actually use them to draw on PDF files.

We completed the development of C$PDF library for upcoming release 10.2.1, which will be available at the end of November 2018.

If you need a patch before that, please raise an Incident using the SupportLine web site.

Best Regards.

----------------------------
Claudio Contardi
Product Support Engineer, Senior
Micro Focus
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.