| Issue 60: | How to set the page size for PDF export? | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Is there any smart way to set the page size and orientation of the
generated PDF document?
I have the concrete problem that I need some exports to PDF in portrait
orientation and others in landscape orientation.
What I did so far is patching the org.jmesa.view.pdf.PdfView with a new
constructor with additional boolean parameter 'landscape'. Then I made a
copy of the file jmesa-pdf.css with a landscape format in the @page entry.
In the new contructor I do the following:
if(landscape)
this.css = "/css/jmesa-pdf-landscape.css";
else
this.css = coreContext.getPreference("pdf.css");
this.doctype = coreContext.getPreference("pdf.doctype");
}
Is there a better way?
Dirk Michaelsen
Nov 27, 2007
The way you should do it would be to just set it using the css attribute and set it
at runtime before you call the render method.
String exportType = tableFacade.getLimit().getExport().getType();
if (exportType.equals(PDF)) {
PdfView pdfView = (PdfView)tableFacade.getView();
pdfView.setCss("/css/jmesa-pdf-landscape.css");
}
tableFacade.render();
Status:
Invalid
|
Labels: -Type-Defect Type-Enhancement