Attache file to PDF
- How-to
- Roy Bungert
- PowerBuilder
- Wednesday, 3 July 2024 11:02 AM UTC
Hello,
I want to attach an existing XML-file to an existing PDF.
At the moment I do the following and it works:
//////////////////////////////////////////
PDFdocument lpdf_doc
PDFattachment lpdf_attach
lpdf_doc = CREATE PDFdocument
lpdf_attach = CREATE PDFattachment
li_rc = lpdf_doc.importpdf( ls_pdffile ) // Import existing PDF
li_rc = lpdf_attach.addfile( ls_xmlfile ) // Read XML
lpdf_doc.attachment = lpdf_attach
li_rc = lpdf_doc.save( ls_pdffile + "tmp" ) // Save as tmp-file
li_rc = FileCopy( ls_pdffile + "tmp", ls_pdffile , TRUE ) // Copy tmp-file-> Originalname
lb = FileDelete( ls_pdffile + "tmp" ) // Delete tmp-file
DESTROY lpdf_attach
DESTROY lpdf_doc
//////////////////////////////////////////
Bit is there another, 'nicer', way to get this job done? I don't like this FileCopy() and FileDelete().
Maybe there's a total other approach?
Regards
Roy
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.