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