In ColdFusion, CFPDF tag can be used to perform several PDF related operations such as adding a watermark, generating thumbnails, deleting pages, merging documents and securing a PDF with password. Today I wanted to merge all my bank statements into a single PDF document, such that only the first page from each document containing the summary of the statement is present in the merged document.
To merge these documents, one can use CFPDF tag with the action attribute set to 'merge'. However, the PDF files that I was trying to merge were password protected. To merge password protected files one can use the CFPDFPARAM tag within a CFPDF tag and provide password there:
As mentioned earlier, the merged document should have only the first page from each document. The CFPDFPARAM tag with the pages attribute set to '1' would consider only the first page while merging. One can also specify a range of pages with "1-5" or a list of pages separated with a comma "1,5,7".
The resultant merged document was not password protected. To secure a PDF file with a password, one can use the CFPDF tag with the action attribute set to 'protect':
To merge these documents, one can use CFPDF tag with the action attribute set to 'merge'. However, the PDF files that I was trying to merge were password protected. To merge password protected files one can use the CFPDFPARAM tag within a CFPDF tag and provide password there:
<cfpdf action="merge"
destination="merged.pdf"
overwrite="yes">
<cfpdfparam source="pdf1.pdf"
password="#password#"
pages="1">
<cfpdfparam source="pdf2.pdf"
password="#password#"
pages="1">
.
.
.
.
</cfpdf>
As mentioned earlier, the merged document should have only the first page from each document. The CFPDFPARAM tag with the pages attribute set to '1' would consider only the first page while merging. One can also specify a range of pages with "1-5" or a list of pages separated with a comma "1,5,7".
The resultant merged document was not password protected. To secure a PDF file with a password, one can use the CFPDF tag with the action attribute set to 'protect':
<cfpdf action="protect"
source="merged.pdf"
newuserpassword="test">
This comment has been removed by the author.
ReplyDeleteI don't know how that works and I'm glad you shared this information with us. Now I know how to merge them in ColdFusion.
ReplyDeletelong island document scanning