My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
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
Status:  Invalid
Owner:  ----
Closed:  Nov 2007


 
Reported by dirk.mic...@googlemail.com, Nov 22, 2007
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 23, 2007
#1 extremec...@gmail.com
Thats not a bad way to go. What is nice about having separate views for everything is
we can do whatever we want. Right now using the stylesheet and the preferences is the
way to add the options. It would be worth really examining the PDF options and
deciding exactly how it could work for developers that really want to customize it!
Status: Accepted
Labels: -Type-Defect Type-Enhancement
Nov 27, 2007
#2 extremec...@gmail.com
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

Powered by Google Project Hosting