PDF Generating Tool Support Forum

HOME   Login   Register    Search

  Subject: problem changing orientation with tomcat
   PostPosted: 02 Jan 2012, 15:43 

I have a problem during my work. I'm using pd4ml to convert html to pdf successfully,
yet changing the orientation to landscape cannot be done by now.

I suspect that, since Tomcat doesn't support all JMS features, perhaps it also doesn't support the AWT.dimension\ Java.awt.Insets exports.

what do you say? any help\ suggestions? this is quite urgent...

Thanks Ahead,

  Subject: Re: problem changing orientation with tomcat
   PostPosted: 03 Jan 2012, 10:58 


I cannot progress unless I solve this issue.

Thanks ahead for the replies...


I used the following code, tring to get landscape orientation while converting html files to pdf:

"<%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml" %> <%@ taglib uri="http://pd4ml.com/tlds/pd4ml/2.6" prefix="pd4ml" %><%@page
contentType="text/html; charset=ISO8859_1"%><pd4ml:transform






<head> ..."


private static void generatePDF(String inputHTMLFileName, File outputPDFFile, Dimension2D format, String fontsDir, String headerBody)
throws Exception {

java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageInsets(new Insets(0, 0, 0, 0));
pd4ml.setPageSize(pd4ml.changePageOrientation((Dimension)format)); // landscape page orientation
if ( fontsDir != null && fontsDir.length() > 0 ) {
pd4ml.useTTF( fontsDir, true );
if ( headerBody != null && headerBody.length() > 0 ) {
PD4PageMark header = new PD4PageMark();
header.setAreaHeight( -1 ); // autocompute
header.setHtmlTemplate( headerBody ); // autocompute
pd4ml.setPageHeader( header );
pd4ml.render("file:" + inputHTMLFileName, fos);

public static void doPDFConvertion(String htmlPath,String outputFile)

String htmlFileName =htmlPath;
File pdfFile = new File(outputFile);

generatePDF(htmlFileName, pdfFile, (Dimension2D)PD4Constants.A4, null, null );
catch(Exception e)
int i=0;

Thanks ahead...

  Subject: Re: problem changing orientation with tomcat
   PostPosted: 04 Jan 2012, 15:11 
Could you please publish a sample of a dummy PDF with "landscape" directive, generated in your environment.

  Subject: Re: problem changing orientation with tomcat
   PostPosted: 05 Jan 2012, 09:48 

Here is a the pdf. it's orientation suppose to be 'landscape'.

(The code seems to ignore the html definitions in the transform tag..)

Untitled.png [ 123.1 KiB | Viewed 2329 times ]
  Subject: Re: problem changing orientation with tomcat
   PostPosted: 05 Jan 2012, 18:20 
> Here is a the pdf
I would call it PNG

  Subject: Here's another Question- related:
   PostPosted: 09 Jan 2012, 10:11 
Preheps there's a chance to split the html table to two different parts easily?

The problem is that,when the table is too large,we loose information this way.

Thanks ahead...

  Subject: Re: problem changing orientation with tomcat
   PostPosted: 09 Jan 2012, 14:06 
I guess you mean table too wide for a single page.

Unfortunately PD4ML offers no way to split a table to columns, that fit a single page width.

Usual solution is to increase htmlWidth conversion parameter. But in the case it scales down the content and at particular values the content is not readable anymore in printed form.

The best approach would be re-think the table layout itself to make it print-friendly: probably to combine some columns etc

  Subject: Re: problem changing orientation with tomcat
   PostPosted: 09 Jan 2012, 16:05 
That would be a little hard to do, since the table is quite complicated and dynamic...

but thanks.

[Reply]     [ 8 posts ] 

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