HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › fonts included in the html
- This topic has 3 replies, 2 voices, and was last updated Mar 22, 2011
14:00:08 byPD4ML.
-
AuthorPosts
-
March 21, 2011 at 10:05#26533
hi
i am using TTF embadding in pro edition to include arabic support , any way how can i make my html to pdf converter work based on the fonts that are provided by the html , i need to get this in my head because i have used the steps you specify for the TTF embadding and its not working .pd4ml.useTTF(“java:fonts”, true);
//pd4ml.useTTF(“/windows/fonts”, true);
pd4ml.setPermissions(“empty”, PD4ML.AllowCopy, false);
pd4ml.setPermissions(“empty”, PD4ML.AllowModify, false);
pd4ml.setHtmlWidth(userSpaceWidth);
pd4ml.setPageSize(format);
pd4ml.adjustHtmlWidth();pd4ml.render(url, fos);
thanks
March 21, 2011 at 14:09#28465HTML does not provide fonts. It only refers to fonts, present on a client PC (where a client browser has physical access to the fonts).
In order to add fonts to a PDF document, PD4ML needs an access to font files (to parse the TTFs, extract used glyphs and embed the extracted subset to PDF document).
JVM may use fonts in Java applications, but it offers no access to physical font files. In order to workaround the restriction, you need to accept TTF embedding “complexities”.
First I would recommend to use the standard font dir.
pd4ml.useTTF(“/windows/fonts”, true);
But before you need to index existing fonts with the command line call:
java -jar pd4ml.jar -configure.fonts /windows/fontsAfter it works you may create a JAR file with selected fonts. But first make sure the above works.
Also if you want to define document access permissions, you should call setPermissions() method only once:
pd4ml.setPermissions(“empty”, PD4ML.AllowCopy | PD4ML.AllowModify, false);
March 21, 2011 at 20:00#28466thank you
so if i do as you say any html tag that contains a font attribute with specific font will be interrepted with the appropriate font that i have just embadded and no need to add any additional code i just need say
pd4ml.usttf(“windows:fonts”,true);thank you
March 22, 2011 at 14:00#28467You need to pass either a directory name of the font dir
pd4ml.useTTF(“/windows/fonts”,true);
or refer to a resource, available via the classloader (distinguished by “java:” prefix)
pd4ml.useTTF(“java:fonts”,true);In both cases pd4fonts.properties file has to be generated in advance with
java -jar pd4ml.jar -configure.fonts …
call. -
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.
