使用DomPDF设置PDF文件的默认页面布局 [英] Set the default page layout of a PDF file with DomPDF

查看:65
本文介绍了使用DomPDF设置PDF文件的默认页面布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用DomPDF生成PDF文件.这可以正常工作,但是我想设置打开文档时使用的默认页面布局.我想在查看文档时拥有100%的视图.实际上,页面已拉伸到窗口的最大宽度.有人知道如何将页面布局设置为单个站点"的解决方案吗?

I am using DomPDF to generate PDF-Files. This works fine, but I want to set the default page layout which is used by opening the document. I want to have a 100% view when the document is viewed. Actually the page is streched to the max width of the window. Does anybody know a solution how to set the page layout to "single site"?

关于,洛思隆(Lothron)

Regards, Lothron

推荐答案

您可以在dompdf中执行此操作,方法是在meta元素中指定视图,例如

You can do this in dompdf by specifying the view in a meta element, e.g.

<meta name="dompdf.view" content="FitV" />

<meta name="dompdf.view" content="XYZ,0,0,1" />

您还可以调用画布类的 set_default_view()方法,例如

You can also call the set_default_view() method of the canvas class, e.g.

$dompdf->get_canvas()->set_default_view('FitV')

只能在实例化PDF文档之后才能使用上述方法.从dompdf 0.6.1开始,这是在调用 $ dompdf-&r; render()之后完成的.

Using the above method can only be done after the PDF document has been instantiated. As of dompdf 0.6.1 that is done after calling $dompdf->render().

引用: https://groups.google.com/d/msg/dompdf/7L2xMLwmH-Y/Et2mBNny51QJ

这篇关于使用DomPDF设置PDF文件的默认页面布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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