Copy link to clipboard
Copied
I'm trying to merge several pdf files into one by using the cfpdf tag (action="merge"). In the source attribute, you can enter a comma delimited list of file paths to merge the pdf files together. I'm thinking that Adobe could have picked a better delimiter though because it breaks if there is a comma any one of the file names. I've tried using replace() to replace the commas in my filenames with chr(44) before passing it to the cfpdf tag, but it still breaks. Any ideas on how to accommodate this? I'm trying to prevent having to copy hundreds of files to a temp directory, then use the directory attribute instead, then delete the temp directory. That just seems like such a waste of resources...
Thanks!
Use the cfpdfparam tag and list them manually perhaps. Or fix the data and files with somethign that is bound to cause issues again and again (regardless if it is technically ok).
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-763e.html
Copy link to clipboard
Copied
If you can, it may be worth writing a quick regex to remove all the commas
from file names that get selected for this process. Once you know the file
names, just use CFFILE to rename any that have a comma, then rebuild the
list of file names from the list of changes.
Copy link to clipboard
Copied
Although that would work, it's not very practical in my case. I would also have to change
the name of the file(s) in the database and would also have to write something to prevent the file name change from overwriting another version of the file (in case one happened to be the exact same but didn't have any commas). It would also cause problems for new versions of the documents because when the architect uploads their new versions, they're typically named exactly the same and thats how we manage our version control. I find it hard to believe that Adobe used a comma to seperate the list instead of one of many other delimiters that are not valid within filenames.
Copy link to clipboard
Copied
Use the cfpdfparam tag and list them manually perhaps. Or fix the data and files with somethign that is bound to cause issues again and again (regardless if it is technically ok).
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-763e.html
Copy link to clipboard
Copied
You might also try using DDX (same concept)
http://livedocs.adobe.com/coldfusion/8/cfpdf_17.html
But I agree that comma "," is a poor choice here. There should be an option to supply an alternate delimiter. Consider submitting an enhancement request
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html
-Leigh
Copy link to clipboard
Copied
cfpdfparam is a WIN! Thanks for the heads up, i had no idea that you could use the tag like that.
<cfpdf
action = "merge"
destination = "C:\Inetpub\mydir\secure\test\output_merge.pdf"
overwrite = "yes">
<cfpdfparam source = "C:\Inetpub\mydir\secure\test\0003. A-001 - Restaurant, Floor Plan.pdf">
<cfpdfparam source = "#expandPath('/secure/test/0001. G-001 - General.pdf')#">
<cfpdfparam source = "#expandPath('/secure/test/0002. G-101 - General Information.pdf')#">
</cfpdf>
Works Great, Thanks!
Copy link to clipboard
Copied
Oh, nice, that is really handy to know.