- Olan Knight
- PowerBuilder
- Friday, 2 September 2022 10:09 PM UTC
UPDATE: Tuesday, 06-SEP-2022. I have attached the two function I used to make this work. (merge_two_pdf_files.txt)
Arg! Text format attachments are not allowed. (Why not?)
Fine.
The code is in the last entry of this thread.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UPDATE: Friday, 02-SEP-2022
The problem was that the FileClose() command returns >>> BEFORE <<< the file that is being created has actually closed! We are creating PDFs, which take far more time to completely close than a TXT file (for example). The code is executed so fast that when the PDFtk command is executed, that file that we FileClosed, which is included in the command line to be processed by PDFtk, does not actually yet exist.
Hot news flash: PDFtk requires files that actually exist in order to process those files. :/
The problem was correct by adding code to ensure that the file actually exists before invoking the PDFTk command line.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PowerBuilder 2019R3, build 2703
Window 10, 64 bit platform
PDFtk_Pro
Chris, I used your suggestion to let PDFtk Pro do our PDF merges.
I purchased PDFtk_Pro today and installed it. No errors.
I updated my code to generate the following command line:
pdftk "Q:\CABSv4\PDF_Notices\018H - PDF Notice #001.pdf" "C:\Personal\Test\018H-018HD0432E-D0432E220902_temp.pdf" cat output "C:\Personal\Test\018H-018HD0432E-D0432E220902.pdf"
This command works perfectly when I run it in a CMD session/cmd prompt window, but fails when I execute RUN (ls_cmd) in the code.
WHAT am I doing wrong in the code?
~~~~~~~~~~~~~~~~~~~~~~~
Works in the CMD prompt:
Resulting file verified:
Fails in the code:
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.