-->

How to Dynamic change paper format margins (Left,

2019-07-31 04:15发布

问题:

I want to change my report paper size dynamically while printing pdf report. Like I have type in my object. When type change then, I want to change my report margin(top, bottom, left, right) which value configure as per margin.

Thanks for your valuable help

回答1:

You can override the method that calls wkhtmltopdf and manipulate the parameters passed there. See odoo.addons.report.models.report.get_pdf function. You can override this, check your variable and call _run_wkhtmltopdf with different arguments.

It does not sound like a good idea though and you would be better off creating multiple paper format records and using them accordingly