How to Dynamic change paper format margins (Left,

2019-07-31 03:50发布

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条回答
霸刀☆藐视天下
2楼-- · 2019-07-31 04:08

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

查看更多
登录 后发表回答