printing bufferedimage to a printer

前端 未结 2 1151
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 17:15

i have an application from which i want to print an image. The image is loaded as a BufferedImage object. The problem is, when i print the image (to the postscript or to the pdf

2条回答
  •  攒了一身酷
    2021-01-21 17:50

    @Viktor Fonic Thank you for this, I was searching a lot to do this! You're solution works perfectly, but has a small error, textSize was not declared, so:

    int textSize =  (int) (pageHeight - image.getHeight()*pageWidth/image.getWidth());
    

提交回复
热议问题