Copy link to clipboard
Copied
Tried posting earlier, but looks like my post wasn't successful so here goes again..
We have an old legacy application that we migrated from CF11 to CF2018. On migration I had noticed that pdfs were taking significant time to generate compared to the previous site/server version. Looking further I found Charlie's post regarding the localURL attribute setting. So trying this I have encountered some weird behaviour in that images/styles still don't load.
I ran the test code below:
<cfdocument name="pdfContent" saveAsName="test.pdf" format="pdf" localurl="yes">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
<font face="Arial, Helvetica, sans-serif" size="+2"><strong>Testing CFDOCUMENT </strong></font>
</td>
</tr>
<tr><td colspan="6">
using back slashes e.g. img src="images\googleLogo.png" <img src="\images\googleLogo.png"><!--- Works ---><br/>
using back slashes and image e.g. image src="images\googleLogo.png" <image src="\images\googleLogo.png"><!--- Doesn't work ---><br/>
using forward slashes e.g. src="images/googleLogo.png" <img src="/images/googleLogo.png"><!--- Doesn't work ---><br/>
using forward slashes e.g. image src="images/googleLogo.png" <image src="/images/googleLogo.png"><!--- Doesn't work ---><br/>
</td></tr>
</table>
</cfdocument>
<cfheader name="Content-Disposition" value="inline; filename=test.pdf">
<cfcontent variable="#toBinary(pdfContent)#" type="application/pdf" reset="Yes">
and get the following output:
Edited: to include correct screenshot.
Things I am noticing:
Forward slashes vs backslashes make a difference. Coldfusion's documentation for cfdocument uses the forward slashes in their example, and this doesn't work.
and the <img> vs <image> tags make a difference.
Am I missing something simple here?
Copy link to clipboard
Copied
s15, a few things:
I have confirmed this (on Windows) for CF2018, 2016, and 11. And I agree that both variants (localurl yes or no) should be able to work with either slash (on any OS).
You could help others if you would file first a bug report (at tracker.adobe.com), reporting the doc mistake if an image tag, and to assert that it should clarify this matter of / vs \, depending on whether localurl yes or no (and depending on the OS).
Then you would still more people to file a feature request there, asking Adobe to change CF so that it works with either slash.
Finally, about your original need, to speed up your CFDOCUMENT processing, you didn't clarify: did the use of localurl help (when you used the img tag and the correct slash for your OS?)
Copy link to clipboard
Copied
Hey Charlie
Thanks for your follow up! Sounds good I'll definitely file a bug report and also the other reports as you mentioned. I'm glad it wasn't something simple I was missing, as it was driving me nuts for the amount of time I spent on this.
With regards to the original requirement, enabling localurl actually did help to improve the cfdocument processing, so I guess Adobe did end up doing something right in that respect.. except I had to go through and alter all the img/style tags to utilize a fully qualified domain reference, eg. https://oursite.com/images/image.jpg for them to show up in the pdf.
Edit: Bug submitted - CF-4208140
Copy link to clipboard
Copied
Great to hear, and thanks for the update--and for the bug report. I have added a vote and a comment (as you will see. I am pointing it out more for other readers. Go vote if you agree with the concerns raised here.)