使用DomPDF设置PDF文件的默认页面布局

编程入门 行业动态 更新时间:2024-10-28 22:24:49
本文介绍了使用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().

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

更多推荐

使用DomPDF设置PDF文件的默认页面布局

本文发布于:2023-11-01 07:34:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1548678.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:布局   页面   文件   DomPDF   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!