Search code examples
pythonwebkitodooopenerp-7

OpenERP Webkit Report Custom Paper Size


In OpenERP 7, when using Webkit to generate reports, how would one specify a custom paper size?

Webkit's default paper sizes are listed at:

http://qt-project.org/doc/qt-4.8/qprinter.html#PaperSize-enum

Of particular interest is paper size type 30:

QPrinter::Custom 30 Unknown, or a user defined size.

The Webkit documentation notes that a custom height and width can be specified:

For a more fine grained control over the page size the --page-height and --page-width options may be used. http://wkhtmltopdf.org/usage/wkhtmltopdf.txt

However, the OpenERP Webkit module does not appear to support direct entry of page height and page width. Possible solutions could include:

  • Add a new paper size to the QPrinter enum, and possibly update Webkit and the OpenERP Webkit module to recognize the new paper size.
  • Add a new paper size directly to Webkit, and possibly update the OpenERP Webkit module to recognize the new paper size.
  • Update the OpenERP Webkit module to allow use of paper size type 30 and to specify page height and page width for Webkit.
  • Some other method entirely.

Suggestions or pointers to documentation regarding any of the above would be welcome. The end goal is to easily generate reports from OpenERP, and most people seem to recommend Webkit for that purpose. Using ReportLab's RML would also be an option, but using Mako, HTML, and CSS seems preferable to using XML, XSL, and RML. Some people appear to have had success designing reports using OpenOffice/LibreOffice and SXW, but the SXW format appears to have been deprecated in current OpenOffice/LibreOffice.


Solution

  • the OpenERP Webkit module supports direct entry of page height and page width. you could define custom paper size in:
    settings/technical/webkit header&footer/(name_of_style_report) and there define paper size and many options more.