Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfpdf merge issue

Status
Not open for further replies.

redoakhg

Programmer
Nov 30, 2006
38
0
0
US
Hi,

I am having a hard time wrapping my head around this issue. cfpdf merge requires the absolute path of the files to be set in the tag, comma delimited. For example, see the following code:
Code:
<cfpdf action="merge"
source="
E:\webs\XXXX\YYYY\ZZZZ\newsletters\Wheat167.pdf,
E:\webs\XXXX\YYYY\ZZZZ\newsletters\SP-500 e-mini220.pdf,
E:\webs\XXXX\YYYY\ZZZZ\newsletters\Soybeans200.pdf"
destination="combsample.pdf" 
overwrite="yes">

I need to get newsletters assigned to a logged in customer from the database (table: clientid_to_newsletter), merge any files that they have rights to see and present them with a link to the newly created merged file.

How can I loop across the assigned files, get the file name and append/concatenate the absolute path to the file name?

i.e. I know the absolute path is: E:\webs\XXXX\YYYY\ZZZZ\newsletters\

However, the file names are dynamic and change from client to client.

Let me know if I am not clear and I would greatly appreciate any help.

 
You don't say if the file path is in the database?
If so this should work:
Code:
<cfquery name="getCustDocs" datasource="#yourSource#">
	Select pdfFileName
	From CustDocs
	Where CustID='#thisCustomerID#'
</cfquery>
<cfif getCustDocs.RecordCount>
	<cfpdf 
		action="merge" 
		source="#ValueList(getCustDocs.pdfFileName)#"
		destination="combsample.pdf" 
		overwrite="yes"
	>
</cfif>
If not you will have to construct the list for the "source" parameter. I didn't test but if I understood your question this this should get you close:
Code:
<cfquery name="getCustDocs" datasource="#yourSource#">
	Select pdfFileName
	From CustDocs
	Where CustID='#thisCustomerID#'
</cfquery>
<cfset docList=''>
<cfoutput query="getCustDocs">
	<cfset elem=E:\webs\XXXX\YYYY\ZZZZ\'&getCustDocs.pdfFileName>
	<cfset docList=ListAppend(docList,elem)>
</cfoutput>
<cfif getCustDocs.RecordCount>
	<cfpdf 
		action="merge" 
		source="#docList#"
		destination="combsample.pdf" 
		overwrite="yes"
	>
</cfif>


Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top