How to Dynamic change paper format margins (Left, Right, Top, Bottom)?

百般思念 提交于 2019-12-11 05:26:39

问题


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



来源:https://stackoverflow.com/questions/46055412/how-to-dynamic-change-paper-format-margins-left-right-top-bottom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!