问题
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