Highlighted

Has anyone found a way to support the equivalent of localurl processing CFHTMLtoPDF?

Adobe Community Professional ,
May 02, 2018

Copy link to clipboard

Copied

Some readers may know that CFDOCUMENT has long had a default behavior that if you had an img src (or similar html tag) that pointed to a local file, CF would under the covers turn that into an HTTP call to get the image, which could cause performance or even functionality problems.

And CF8 added a new optional attribute to change that behavior: LocalURL.  (See my blog post from 2011 for more on that: http://www.carehart.org/blog/client/index.cfm/2011/11/19/perf_fix_via_cfdocument_localurl_attribute.)

Sadly, it seems that the new CFHTMLtoPDF (added in CF11) works the same way (I've confirmed by viewing web server logs showing it creating URLs to get images via the web server), and yet it does NOT offer that LocalURL attribute to change that behavior.

Has anyone else encountered or solved this?  I have done a lot of searching about it, to no avail.

I did find that the underlying WKHTML kit does itself offer a --enable-local-file-access option, but it's only for use with the WKHTMLtoPDF that it uses, and upon which CFHTMLtoPDF is based (https://wkhtmltopdf.org/usage/wkhtmltopdf.txt). But I cannot see any way to pass in such an argument to CFHTMLtoPDF.

/Charlie (server troubleshooter, carehart.org)

Views

359

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Has anyone found a way to support the equivalent of localurl processing CFHTMLtoPDF?

Adobe Community Professional ,
May 02, 2018

Copy link to clipboard

Copied

Some readers may know that CFDOCUMENT has long had a default behavior that if you had an img src (or similar html tag) that pointed to a local file, CF would under the covers turn that into an HTTP call to get the image, which could cause performance or even functionality problems.

And CF8 added a new optional attribute to change that behavior: LocalURL.  (See my blog post from 2011 for more on that: http://www.carehart.org/blog/client/index.cfm/2011/11/19/perf_fix_via_cfdocument_localurl_attribute.)

Sadly, it seems that the new CFHTMLtoPDF (added in CF11) works the same way (I've confirmed by viewing web server logs showing it creating URLs to get images via the web server), and yet it does NOT offer that LocalURL attribute to change that behavior.

Has anyone else encountered or solved this?  I have done a lot of searching about it, to no avail.

I did find that the underlying WKHTML kit does itself offer a --enable-local-file-access option, but it's only for use with the WKHTMLtoPDF that it uses, and upon which CFHTMLtoPDF is based (https://wkhtmltopdf.org/usage/wkhtmltopdf.txt). But I cannot see any way to pass in such an argument to CFHTMLtoPDF.

/Charlie (server troubleshooter, carehart.org)

Views

360

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 02, 2018 0
Enthusiast ,
May 02, 2018

Copy link to clipboard

Copied

Hi Charlie

You can use a data URI - that is a base64 encoded string representation using the data: scheme in the src attribute of the img tag.

Here's a code example:

<cfhtmltopdf>

  <h1>Hello World</h1>

  <cfoutput><img src="data:image/png;base64,#toBase64(fileReadBinary(ExpandPath("./foundeo.png")))#"></cfoutput>

</cfhtmltopdf>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 02, 2018 1