Regression: Local images no longer render in PDF in Lucee 5.3+

Description

This code produces a PDF with an image that pulls from a local file path and works on Lucee 5.2

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:

That would turn the path above (that worked in Lucee 5.2) into this:

Environment

None

Activity

Show:
Michael Offner
August 22, 2020, 1:29 AM

Brad Wood
August 22, 2020, 1:50 AM

Looking at your commit, I have some concerns about your implementation. Instead of using my fix I provided in the ticket and confirmed, it appears you're reading the image to base64 and including it inline in the PDF. I stronglyk recommend against this. I tested this and while it works well for small PDFs containing few images, it performs very poorly for large PDFs containing a lot of images.

Can you please confirm that the PDF extension will not be trying to convert all images to base64 and in-lining them. That is not a good solution. The best solution is the one I showed in the ticket description.

Michael Offner
August 23, 2020, 4:43 AM

fair concern. I will use a Uri path in case of a already local file. that is a simple change. but i will still download external files, the http FS already can use the global proxy.

BTW better use HTTPUtil.toURL(…) instead of new URL() it will give you better results.

Michael Offner
August 24, 2020, 7:27 PM

OK changed the implementation as suggested

Brad Wood
August 25, 2020, 2:34 AM

Thanks Micha!

Fixed

Assignee

Michael Offner

Reporter

Brad Wood

Priority

New

Labels

Fix versions

Sprint

5.3.8 Sprint 3