mergePDFCollection
Combines all the PDF Files found in a given Collection into one and stores the resulting PDF File into the variable context. The merged document will have the content of its components appearing in the order in which the items are in the Collection.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the name of the variable holding the merged PDF File. If the |
value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | Collection | Yes |
Defines the Collection that contains the PDFs to merged. The resolved value should therefore be a Collection, otherwise an error is produced. The Collection may contain values of any kind - all the contents are checked and File values that report to be PDF documents are picked up to be merged. If no such Files can be found, no merging can be done and the result of the merge will be |
name | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines a name for the merged PDF file. File suffix should not be included. If not defined, the merged PDF's name will be "merged". |
Examples
The mergePDFCollection
command is a good alternative to mergePDF if the goal is to merge together a variable number of PDFs. If creating PDFs in a loop, for example, they can be just placed into a Collection and then merged after the loop, like this:
<setCollection var="pdfDocs"><forEach value="${documents}" var="doc"><exportPDF var="pdfDoc" value="${doc}"><addItem value="${pdfDoc}" collection="${pdfDocs}"><mergePDFCollection var="mergedDoc" value="${pdfDocs}" name="${mergedDocName}">