I have an application for which the final output is a pdf report about an applicant from a database of applicants.
If I print the form just once, all the stylesheet formatting is applied correctly.
If I try to loop through the database and generate multiple reports of multiple applicants, the styles and formatting get applied ONLY to the first report, and then the subsequent reports do not have any styles applied which of course makes them unacceptable.
I've tried loading the stylesheet before the loop and inside the loop, no difference.
The styles being lost are for divs and tables and cells. Fonts are handled separately by calling functions within the report which apply them on the fly.to text based on the section and type of output.
Is anyone familiar with this problem? Is there a workaround? I really really really need this to work.
I do not know the cause, but if all else fails you could move the cfdocument code to a separate template. Then the styles seem to work as expected.
<!--- loop code --->
<cfloop from="1" to="5" index="x">
<!--- call separate script cfinclude, cfmodule, etcetera ... --->
<!--- test.cfm --->
<cfdocument format="pdf" filename="testpdf-#url.x#.pdf" overwrite="true">
<div style="background-color: #ff0000;">Test div</div>