- Daniel Vivier
- PowerBuilder
- Tuesday, 29 June 2021 07:43 PM UTC
There's an enhancement request somewhere to add the capability for the NativePDF saving of DataWindows to append their output to an existing PDF.
In the meantime, I really wanted that ability, so users of our software could put multiple reports into one PDF without using external tools.
My solution has our program including and using an external open source tool, QPDF, so the user doesn't have to! you get it from https://sourceforge.net/projects/qpdf/.
QPDF can actually do a bunch of things with PDF files, either via a command-line, or via a C++ library (which also apparently also has at least a partial C implementation, which I guess thus might be callable from PB). But I just use the command line.
The command line to append file2.pdf to file1.pdf is:
qpdf "file1.pdf" --pages . "file2.pdf" -- --replace-input
You don't need the quotes unless there are (or might be!) spaces in the filenames. It can also append multiple files together, pick only selected pages, and a ton of other things. You can see the manual online for more details.
The part of it that I need to deploy with my program is a bit over 4MB, which isn't bad.
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.