Welcome! Log In Create A New Profile


[WD27] - Merging PDF Files

Posted by JP 
[WD27] - Merging PDF Files
March 31, 2023 01:12PM
Hi All

I want to merge a variable number of PDF files into a single master file. The number of PDF fils will change from time to time. I can use PDFMerge() for this but how do I cater for the variable number of PDF files in the parameter list?

<Result> = PDFMerge(<Result PDF file> , <PDF file 1> , <PDF file 2> [, <PDF file 3> [... [, <PDF file N>]]])

Re: [WD27] - Merging PDF Files
March 31, 2023 02:17PM

you could do it with the compile function: (dynamic compilation)

all you have to do is to build the source code containing the pdfmerge statement depending on the actual files

regards, Heinz
Re: [WD27] - Merging PDF Files
March 31, 2023 07:36PM
Why don't you merge one at a time in a loop using the result of the first iteraction as the first file to merge in the second iteraction and so on.


Paulo Oliveira
Re: [WD27] - Merging PDF Files
April 01, 2023 01:41AM
Hello JP,

The help example shows you can fil an array with file names or you could use stringbuild() for the first example method

// Merges 2 PDF files into a single one
PDFMerge("C:\PDF Doc\pdf_merge.pdf", "C:\PDF Doc\ReportQuery.pdf", "C:\PDF Doc\Concepts.pdf")

// Merges the files in PDF format found in an array
MyPDFArray is array of 3 strings
MyPDFArray[1] = "C:\Doc\Functions1.pdf"
MyPDFArray[2] = "C:\Doc\Functions2.pdf"
MyPDFArray[3] = "C:\Doc\Functions3.pdf"
PDFMerge("C:\Doc\pdf_merge.pdf", MyPDFArray)

Re: [WD27] - Merging PDF Files
April 01, 2023 12:51PM
Thanks Al and Everyone, great suggestions.

Al, I cannot believe I missed the array option in the help - blinded by the obvious.

Thanks eveyrone.

Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.