我如何打印我的面板,从 (locationx,locationy) 到 (panel.getWidth(),panel.getHeight())?

发布于 2024-12-20 14:53:17 字数 382 浏览 2 评论 0原文

我有这个链接,我可以使用这个示例来打印我的面板: 打印示例 我用它来打印我的面板:

PrintUtilities.printComponent(this);

“this”是面板。但打印后,纸上的面板并不满。仅(大约)宽度的 70% 和高度的 60%。 (抱歉我的英语,我是匈牙利语)面板尺寸为:850x1160。这是 A4 纸的示例尺寸:595x842 -> 70dpi=A4。 请帮助我,如何将我的面板完全打印到 A4 纸上。 谢谢你!

I have this link, and I can use this sample, to print my panel:
print example
I use this, to print my panel:

PrintUtilities.printComponent(this);

"this" is the panel. but after the printing, on the paper the panel is not full. Only the (about) 70% of the Width, and 60% of the Height. (sorry for my english, i am hungarian) The panel size is: 850x1160. This is the example size to an A4 paper: 595x842 -> 70dpi = A4.
Please help me, how to print my panel FULLY to an A4 paper.
Thank you!

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

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

发布评论

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

评论(1

七月上 2024-12-27 14:53:17
double factorX = pf.getImageableWidth() / component.getWidth();
double factorY = pf.getImageableHeight() / component.getHeight();
double factor = Math.min( factorX, factorY );
g2.scale(factor,factor);

谢谢大家的回答!

double factorX = pf.getImageableWidth() / component.getWidth();
double factorY = pf.getImageableHeight() / component.getHeight();
double factor = Math.min( factorX, factorY );
g2.scale(factor,factor);

thanks for the answers everybody!

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