It is, as you say, an old issue. I am surprised that it remains unsolved even in the current version of ColdFusion.
I have found the following workaround.
1) Save the output of cfdocument, that is, this code:
<cfdocument format = "PDF" filename="./docs/#filename#" overwrite="yes" localurl="true">
as the page inc.cfm, in the current directory.
2) Replace the content of the current page with
<cfloop query = "MyQuery">
Thanks, BKBK, for your reply. I am not sure if your solution would work though, since I will need to write to the PDF different message and save to a different file during each loop, with the same background. Please advise. Thanks again...
The example I have given you would work. It is all dynamic as I will now show.
In the following example, save the 2 CFM files and the image files in the same directory. Then open testFile.cfm in the browser. That will dynamically create 3 PDFs in the current directory
<cfloop list= "1,2,3" index="idx">
<cfdocument format = "PDF" localurl="true" filename="#expandPath('file#idx#.pdf')#" name="file#idx#" overwrite="true" >
<body style="background-image:url('testImage#idx#.png');background-repeat: no-repeat;">
HTML body content of page#idx#
It worked! Thank you, thank you so much!!!