如何动态更改纸张格式边距(左,右,上,下)? [英] How to Dynamic change paper format margins (Left, Right, Top, Bottom)?

查看:82
本文介绍了如何动态更改纸张格式边距(左,右,上,下)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在打印pdf报告时动态更改报告纸的尺寸.就像我输入对象一样.然后,当类型更改时,我想更改报告边距(上,下,左,右),该值按边距配置.

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.

感谢您的宝贵帮助

推荐答案

您可以覆盖调用wkhtmltopdf的方法并处理在此传递的参数.请参见odoo.addons.report.models.report.get_pdf函数.您可以覆盖它,检查变量并使用不同的参数调用_run_wkhtmltopdf.

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

这篇关于如何动态更改纸张格式边距(左,右,上,下)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆