Fixed
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Brad Wood
Brad WoodPriority
Labels
Fix versions
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
None
Created 4 November 2019 at 18:47
Updated 27 August 2020 at 15:13
Resolved 27 August 2020 at 15:13
This code produces a PDF with an image that pulls from a local file path and works on Lucee 5.2
<cfoutput> <cfdocument format="PDF" filename="testout.pdf" overwrite="true" localurl="true"> Here is an image: <img src="file:///D:\path\to my\image.jpg"> </cfdocument> done </cfoutput>
However, the same code produces a PDF with no image on Lucee 5.3+
I've narrowed down to the fact that Lucee 5.3's PDF engine requires the file paths to
Be URL encoded (sort of as URLEncodedFormat() and encodeForURL() both cause issues)
use only forward slashes, even on Windows.
If I run all my local file paths through this code, it seems to work:
function pathToURL( required string path ) { return createOBject( 'java', 'java.io.File' ).init( path ) .toURI() .toURL() .toString(); }
That would turn the path above (that worked in Lucee 5.2) into this:
file:/D:/path/to%20my/image.jpg