PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: TTF not working with Pro version also footer not working
   PostPosted: 29 Jun 2010, 08:27 
Embedding a true type font has not worked with the pro version

Source urls for each page:

http://mesoderm-ext.cambrient.com/sat/c ... oid=203894
http://mesoderm-ext.cambrient.com/sat/c ... oid=203894
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure
http://mesoderm-ext.cambrient.com/sat/c ... -ebrochure

source 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("<b>Footer test</b><br>" + "${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 folder

Java version: 1.6.0
PD4ML version: pd4ml.prof.360fx1.zip
Operating system: Ubuntu 8.04

the pdf generated is here

http://mesoderm-ext.cambrient.com/sat/a ... 505131.pdf

The second problem is the footer html source is not displaying and the 2 pages are not skipped.


Attachments:
pd4fonts.properties [707 Bytes]
Downloaded 282 times
ttf.tgz [128.14 KiB]
Downloaded 76 times
  Subject: Re: TTF not working with Pro version also footer not working
   PostPosted: 29 Jun 2010, 12:11 
pd4ml.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 );


  Subject: Re: TTF not working with Pro version also footer not working
   PostPosted: 30 Jun 2010, 10:06 
thanks, 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("<b>Footer test</b><br>" + "${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?


  Subject: Re: TTF not working with Pro version also footer not working
   PostPosted: 05 Jul 2010, 20:11 
Yes, 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



[Reply]     [ 4 posts ] 

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