如何让pdf打印输出占满整个A4纸

发布于 2024-11-01 11:11:50 字数 108 浏览 1 评论 0原文

我使用 jboss seam iText 模块生成一个示例 pdf 文件,默认情况下以 143% 的页面放大倍率呈现。当我打印出来时,输出并没有占据整个页面。我应该修改哪些设置才能使打印输出使用整张纸。

I use jboss seam iText module to generate a sample pdf file, which by default renders with a page magnification of 143%. When I take a print out, the output doesn't occupy the entire page though. What settings should I modify to make the print out use the entire sheet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

相对绾红妆 2024-11-08 11:11:50

如果您使用的是 seam-pdf,文档大小的设置位于 标签中:

<p:document type="pdf"
            pageSize="A4"
            orientation="portrait"
            margings="2cm, 2cm, 2cm, 2cm"
            disposition="attachment"
            title="Document title"
            subject="Document subject (appears in the doc properties from pdf viewer)"
            author="Document Author"
            creator="Document Creator">

<!-- define the page here -->


</p:document>

If seam-pdf is what your are using, settings for document size are in the <document> tag:

<p:document type="pdf"
            pageSize="A4"
            orientation="portrait"
            margings="2cm, 2cm, 2cm, 2cm"
            disposition="attachment"
            title="Document title"
            subject="Document subject (appears in the doc properties from pdf viewer)"
            author="Document Author"
            creator="Document Creator">

<!-- define the page here -->


</p:document>
归途 2024-11-08 11:11:50

您可以将初始页面尺寸更改为 A4。

Document doc = new Document(PageSize.A4);

您可以要求您的用户正确配置他们的打印机。在 Reader X 中,有一个“页面缩放”下拉列表,选项之一是“适合可打印区域”。我相信以前的版本有一个用于相同控件的复选框,但我不确定。

您可以更改初始页面视图,但这不会改变打印行为......至少不会改变您想要的方式。请参阅 PdfViewerPreferences,由 PdfWriter.

还有一个 javascript 方法,doc.print(...),无需用户输入即可控制所有这些,但“无用户输入”参数需要特殊执行权限...您也许能够通过证书安全性和一些用户设置来安排这一点,但话又说回来,您可能不会。

You can change your initial page size to be A4.

Document doc = new Document(PageSize.A4);

You can ask your users to configure their printer properly. In Reader X there's a "Page Scaling" drop list, and one of the options is "Fit to Printable Area". I believe previous versions had a check box for the same control, but I'm not sure.

You can change the initial page view, but that won't change the printing behavior... at least not the way you want. See PdfViewerPreferences, implemented by PdfWriter.

There's also a javascript method, doc.print(...), that can control all of that without user input, but the "no user input" parameters require Special Execution Privileges... you might be able to arrange that with certificate security and some user settings, but then again, you might not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文