CFDOCUMENT has been the bane of my existence for years. Check out this simple 
dynamic PDF packaging code which should work...

<CFSET PAGEARRAY = [] />
<CFLOOP from="1" to="3" index="i">
<CFDOCUMENT FORMAT="PDF" NAME="PDFPAGE">
<html><body><div 
style="background:url(http://www.houseoffusion.com/_/hof120.gif)"><BR>&nbsp;</div></body></html>
</CFDOCUMENT>
<cfset arrayappend(PAGEARRAY,PDFPAGE) />  
</CFLOOP>
<CFDOCUMENT FORMAT="PDF" NAME="PDFPAGE">
<html><body><div 
style="background:url(http://www.houseoffusion.com/_/hof120.gif)"><BR>&nbsp;</div></body></html>
</CFDOCUMENT>
<cfset arrayappend(PAGEARRAY,PDFPAGE) />  
<CFPDF action="merge" name="FINALPDF">
 <cfloop from="1" to="#arraylen(PAGEARRAY)#" index="i">  
   <cfset pointer = PAGEARRAY[i]/>  
   <cfpdfparam source="pointer">
 </cfloop>
</CFPDF>        
<cfcontent type="application/pdf" variable="#tobinary(FINALPDF)#">


If you run this (on CF8 or CF9 - not tried 10) you will notice that the image 
appears only on the first and last page! Why? Because CFDocument ignores 
background images after the first call when in a loop. I was able to prove this 
by putting the call into a CFINCLUDE inside the loop. But then, if you add a 
CFDOCUMENTITEM to it, it throws an error: "Routines cannot be declared more 
than once". According to Adobe there was a hotfix for this in CF8, although it 
did not work for me.

Anyone know CFDoc well enough to present another solution?

TIA,
Igor


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351366
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to