Link to home
Start Free TrialLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

Populate pdf with Coldfusion

I have a PDF template. And I am using Coldfusion and database to get the data. Now i need to take that data and populate the PDF.  the data size is different so sometimes it is 1 page and sometimes 1+.

My template is only 1 page. How can I use the same template to say add another page
Avatar of _agx_
_agx_
Flag of United States of America image

Not sure what you mean by "data size".  This old thread talks about populating a LC form with a query.  I don't use LC, but the number of pages that creates probably depends on how the form is structured.

https://www.experts-exchange.com/questions/26528588/not-getting-multiple-rows-in-subform-with-cfpdfsubform.html
Avatar of erikTsomik

ASKER

Thank you. I have the screen shot of my form
User generated image
And the assosiated code

<cfpdfform source="..\_pdf\dts100.pdf"
           destination="..\_pdf\Client-Order-Dynamic.pdf" <!--- this will be created --->
           action="populate"
           overwrite="yes"
           overwritedata="yes"
           >   
           <cfpdfsubform name="topmostSubform">
           		<cfpdfsubform name="subForm1">
                   			<cfpdfformparam name="school_name" value="Construct., Inc" />
                   
                </cfpdfsubform>	
           </cfpdfsubform>	
   </cfpdfform>     

Open in new window

What's the result when you populate the complete form?
User generated imageI have decided to populate with xmldata.

<cfpdfform action="populate" source="#Request.PDFLoc#\#Arguments.docFileName#" xmldata='<?xml version="1.0" encoding="UTF-8"?>
                <topmostSubform>
                	<cfoutput >
                		
                	
                	<cfloop from="1" to="#ClassInfo.numPages#" index="i">
                		<SubForm"#i#">
                			
                			<school_name>#ClassInfo.school_name#</school_name>
                   			<TextField1>#ClassInfo.school_code#</TextField1>
                  			<preparer>#ClassInfo.preparer#</preparer>	
                  			
                		</SubForm"#i#">
                	</cfloop>
                   </cfoutput>
                </topmostSubform>' overwritedata="yes" />

Open in new window


where ClassInfo.numPages is the number of pages

I gave the subform a unique name for each page but only populate first page
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial