HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › TTF not working with Pro version also footer not working
- This topic has 3 replies, 3 voices, and was last updated Jul 05, 2010
18:11:28 byPD4ML.
-
AuthorPosts
-
June 29, 2010 at 06:27#26409
Embedding a true type font has not worked with the pro version
Source urls for each page:
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-brochure-cover-page?brochure_action=cover_page&oid=203894
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-brochure-cover-page?brochure_action=toc&oid=203894
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=9197&sn=Detail-ebrochure
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=19480&sn=Detail-ebrochure
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=8619&sn=Detail-ebrochure
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=13866&sn=Detail-ebrochure
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=11361&sn=Detail-ebrochure
http://mesoderm-ext.cambrient.com/sat/content/en/za/trade-popup-detail?oid=1854&sn=Detail-ebrochuresource code:
private void generatePdf(String outputFileDir, String outputFileName,
URL[] urls) throws IOException {
File file = new File(outputFileDir + outputFileName);
FileOutputStream pdfOut = new FileOutputStream(file);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageSize(PD4Constants.A4);
pd4ml.setPageInsets(new Insets(0, 0, 0, 0));
pd4ml.setHtmlWidth(1000);PD4PageMark footer = new PD4PageMark();
footer.setPagesToSkip(2);
footer.setAreaHeight( 50 );
footer.setHtmlTemplate(“Footer test
” + “${page} of
${total}” );pd4ml.setPageFooter( footer );
pd4ml.useTTF( “java:fonts”, true );
pd4ml.setDefaultTTFs(“Trebuchet MS”,”Tahoma”,”Arial”);
pd4ml.render(urls, pdfOut);
pdfOut.close();
}attached are the true type fonts and the
pd4fonts.properties file from the jre/lib/fonts folderJava version: 1.6.0
PD4ML version: pd4ml.prof.360fx1.zip
Operating system: Ubuntu 8.04the pdf generated is here
http://mesoderm-ext.cambrient.com/sat/applications/sat/custom/test/brochure_1277304505131.pdf
The second problem is the footer html source is not displaying and the 2 pages are not skipped.
June 29, 2010 at 10:11#28081pd4ml.useTTF( “java:fonts”, true ); assumes, the fonts and pd4fonts.properties are packed to JAR and the JAR is added to the application CLASSPATH.
Brief info about TTF embedding: pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html
If you would like to use fonts from jre/lib/fonts, you need to specify the absolute font directory path. For example:
pd4ml.useTTF( “/usr/lib/jvm/java-1.5.0-sun/jre/lib/fonts”, true );
June 30, 2010 at 08:06#28082thanks, the fonts are working now that I put in the full path to the jre/libs/fonts folder. rtfm.
However the footer is still problematic. With this source code:
footer.setPagesToSkip(2);
footer.setAreaHeight( 50 );
footer.setHtmlTemplate(“Footer test
” + “${page} of ${total}” );What happens is the htmltemplate does skip the first 2 pages but the area height does not.
I want to fill up the entire page with a graphic in the first 2 pages and then only from pages 3 onwards must the footer area height be set. Is this possible?
Either that or can I create a separate footer for the first 2 pages which I will fill up with a graphic?
July 5, 2010 at 18:11#28083Yes, footers defined via API always allocate specified space, even if for a particular page they must be skip.
You may achieve the needed footer appearance with so-called inline footers, using
<pd4ml:page.footer>tag. See the topic for more details:html-pdf-faq-f1/pdf-page-headers-footers-definition-options-t41.html
-
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.
