PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: fonts included in the html
   PostPosted: 21 Mar 2011, 12:05 
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


  Subject: Re: fonts included in the html
   PostPosted: 21 Mar 2011, 16:09 
HTML 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/fonts

After 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);


  Subject: Re: fonts included in the html
   PostPosted: 21 Mar 2011, 22:00 
thank 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


  Subject: Re: fonts included in the html
   PostPosted: 22 Mar 2011, 16:00 
You 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.



[Reply]     [ 4 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share