我创建了一个具有特定像素大小的缓冲图像,我尝试将其发送到打印机对话框,但是当我将其发送到打印机时,大小对于我的目标(证卡打印机)来说太大了
这是我的目标:
BufferedImage bi
这是我迄今为止尝试过的,包括我的对象:
Printing a BufferedImage in Java
http://docs.oracle.com/javase/tutorial/2d/printing/dialog.html
还有几个例子,但我找不到答案
我正在寻找一种简单的方法,将我的缓冲图像发送到打印对话框,其高度/宽度适合我的证卡打印机。 谢谢。
最佳答案
I have created a buffered image with specific pixel size and i tried to send it to printer dialog but when i send it to printer the size is way to big for my goal (card printer)
看看public Image getScaledInstance(int width, int height, int hints) ,您可以在其中设置所需的像素比例
注意
ScaledInstance
是异步的,在某些情况下,当
XxxImage
、Icon
、ImageIcon
时必须调用flush()
放置在JLabel
中
关于java - 以特定大小打印 Bufferedimage 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14705981/