G'day... I'm having (no end of) trouble trying to ...
# lucee
b
G'day... I'm having (no end of) trouble trying to get a custom font to work with cfdocument. I think it was working a few months ago but it has been a work in progress so I'm not 100% on that one. More info in thread...
Lucee 5.4.3.11-RC and PDF ext v1.1.0.19 I tried backing up the version of the PDF extension and got as far as 1.0.0.80 before it started failing entirely but all with the same result.
I'm using the 'fontdirectory' parameter and the font I need is definitely there and the name of the font file has the same case as the font-family. And I have tried putting the font files in the WEB-INF/Lucee/fonts folder.
And I just had a thought that the font might not be being injected into the style of the html elements, but it is.
z
b
I mentioned "PDF ext v1.1.0.19" earlier and have just tried 1.2.0.10-RC with the same result.
z
but the naming as per mentioned in the linked issue
b
yes, also mentioned above - font-family name and font file name share the same case.
z
classic or modern?
b
What does that mean? I've seen it mentioned but assumed it referred to the version if the PDF extension.
z
there are two pdf engines in the pdf extension
b
it must be 'modern' - I don't set it and that is the default
but just in case I added the 'type' parameter but sadly the result was the same.
z
d
@brettpr I don't use the PDF extension (we use wkhtmltopdf) but a few things I'd check: • Look through your logs to see if you can find any exceptions being thrown. • Check the permissions on the fonts. Maybe Lucee doesn't have permissions to read them, so it's not picking them up.
b
sigh - it is the font file itself... it works in the browser but the PDF engine doesn't like it for some reason. I worked this out by trying an alternative custom font which worked ok... 🙄
In case someone is able to give me a second opinion...
d
@brettpr Just to confirm, the file permissions (r/w and user/group) are the same as the font that does work?
It's possible the file is slightly corrupted too. Something the browser is handling, but the Java libs in Lucee are not. You might try re-downloading it to the server.
b
@dswitzer - yes, all are the same. The font file works for html rendering and when installed on my PC - but not when included with cfdocument.
d
Maybe something like this might reveal something: https://github.com/HinTak/Font-Validator/
b
I've also tried wkhtmltopdf and that also works and am heading down the path of trying that on a test server
d
One of the "pluses" in my book for wkhtmltopdf is because it runs outside of the JVM, we didn't need to worry about JVM memory heap issues when processing large HTML documents, which used to be a problem. I wish there were more work done to keep the tool updated with Chromium, but it still works pretty good.
b
@dswitzer - the font testing tool is awesome, thank you! I obviously didn't look deeply enough when I searched for font testing tools. The font file is indeed faulty, I guess in some way that seems to only matter to the PDF engine used by Lucee.
d
@brettpr I suspect other tools would have issues too, but glad you found the root issue. That's why I thought it might be a permissions issue, since other fonts worked. I thought maybe something was preventing the JVM from loading the font.