Java自定义纸张

thinkhua 2009-12-23 08:27:15
在Java程序里,如何自定义纸张?
...全文
151 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
thinkhua 2009-12-25
  • 打赏
  • 举报
回复
难道在Java程序里面真的没有办法自定义宽>高的纸张了?按RoSippA的说法,只能手动向打印机注册了。
bestfreddy2 2009-12-24
  • 打赏
  • 举报
回复
学习!
huntor 2009-12-24
  • 打赏
  • 举报
回复
http://it-develops.blogspot.com/2007/08/java-printer-vs-customize-paper-size.html
Wednesday, August 1, 2007
JAVA Printer vs Customize Paper Size
How to printing in my paper size?
If you want to print to your custom paper size, you can custom in your java code(Paper Class or findMediaSize() method), but if the custom size does not in the standard paper sizes, Printer API will select the nearly paper size from standard sets(height must more than width forever).
According above, it can't completely when your paper isn't in standard size sets. You can do this to add your paper size to standard sets
in this case my OS is Windows XP
goto -> Printers and Faxes -> File -> Server Properties (in this dialog you can add your paper)

After you do that, the Printer API will see your paper in standard sets but paper height must more than width forever.
Posted by RoSippA at 3:43 PM
thinkhua 2009-12-24
  • 打赏
  • 举报
回复
使用paper.setSize()是不行的,PageFormat和Media是有区别的,但是MediaSize又要要求宽<=高,现在想定义一个宽>高的MediaSize(也就是自定义了一种纸张),不知道该如何实现。
huntor 2009-12-24
  • 打赏
  • 举报
回复
请查看java.awt.print包里的Paper,PageFormat
crazylaa 2009-12-24
  • 打赏
  • 举报
回复
楼主去sun的网站看看,里面有Print类的,支持设置纸张的接口如果有就可以实现,没有就晕菜吧
nj_dobetter 2009-12-23
  • 打赏
  • 举报
回复
JAVA里面有控制打印的标准库
thinkhua 2009-12-23
  • 打赏
  • 举报
回复
不好意思,可能是我的问题的表述有问题,我指的是如何在Java程序里自定义一种纸张(随便定义),然后让打印机按照自定义的纸张的规格来打印。不过,还是非常感谢你的回复,谢谢。
sean1203 2009-12-23
  • 打赏
  • 举报
回复
class Paper{
添加属性和动作

}

51,396

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧