add support for attribute fontdirectory to tag document
Description
Attachments
- 23 Jan 2022, 01:24 pm
is duplicated by
relates to
Activity
Da Li 23 January 2022 at 13:24(edited)
@Brad Wood @Umair Khan Following gaia-jyh's suggestion, I finally got a working example with Chinese in the PDF (Lucee 5.3.8+206, MacOS Monterey 12.1).
<cfdocument type="classic" format="PDF" fontEmbed="true" fontdirectory="#expandPath('/data/fonts')#">
<style>
* {
font-family: "Courier New", "PingFang SC Regular";
}
</style>
<h1>Hello,你好!</h1>
</cfdocument>
The name of the game is using the type="classic"
In this example, "PingFang SC Regular"
is the Chinese font name, which comes with MacOS.
Here’s the rendered PDF inside Chrome.
Of course this is a compromise solution as type Classic uses the old engine PD4ML.
gaia-jyh also demonstrated in his post how to fix it with the new engine.
Ignore me if you’ve already found a solution.
Umair Khan 4 December 2020 at 15:55
I am also having the same problem I setup the separate font directory and given the path. Fonts are loading but not showing to the PDF
Brad Wood 13 November 2019 at 17:56
@Justin Biggs @Jonas Eriksson@Michael Offner Does this approach work in Lucee 5.3 and Flying Saucer? I've got a PDF full of chinese characters that are simply not showing up at all. Setting the fontDirectroy does nothing at all. No errors, warnings, or changes in the PDF. In fact, the PDF's document properties show the exact same set of fonts it had before. I'm not sure the setting even does anything.
Justin Biggs 2 July 2018 at 00:56
@Jonas Eriksson
I was having the same problem. I put my fonts in a separate folder next to the folder containing my function and set the fontdirectory="../fonts" and it worked. I had to delete the pd4fonts.properties file that was created as I added a couple of new fonts and they weren't working. Once I deleted that file and re-ran my <cfdocument> function it worked and re-built the pd4fonts.properties file with all of the fonts in that folder.
Jonas Eriksson 5 June 2018 at 16:07(edited)
Hi Michael, I am trying to get Segoe UI to show up in my PDF created with CFdocument on Lucee 5.x (latest stable) on Ubuntu. Am I correctly understanding that my cfdocument tag look like this:
<cfdocument
format="pdf"
name="testPDF"
pagetype="A4"
orientation="portrait"
fontEmbed="true"
fontdirectory="myfonts"
>
and I then have a directory in the same level as my cfm template calling the above cfdocument code, names myfonts, which contains a couple of ttf fonts?
In my testing, this does not work, and there is also no pd4fonts.properties file being created. In my Lucee Server admin, I see that the extension pdf.extension 1.0.0.68 pdf.extension-1.0.0.68.jar extension active is loaded? Thanks for any additional hints you can provide!
Details
Details
Assignee
Reporter
Labels
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
add support for attribute fontdirectory to tag document.
this attribute can contain a directory containing .ttf files that then can be used as fonts inside cfdocument.
the file pd4fonts.properties is optinal and will be generated by the extension when missing.