X-Received: by 10.236.125.228 with SMTP id z64mr10631510yhh.47.1381827394232; Tue, 15 Oct 2013 01:56:34 -0700 (PDT) X-Received: by 10.50.79.228 with SMTP id m4mr426030igx.9.1381827394066; Tue, 15 Oct 2013 01:56:34 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!o2no5904224qas.0!news-out.google.com!9ni40949qaf.0!nntp.google.com!o2no5904211qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.help Date: Tue, 15 Oct 2013 01:56:33 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=114.35.196.141; posting-account=aiIU5goAAABmC6C8L5MOatvh6EfoUUq0 NNTP-Posting-Host: 114.35.196.141 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <103e51b9-a464-4d94-b3e6-e752f014e546@googlegroups.com> Subject: Print BufferedImage the result is blank From: p7371464@gmail.com Injection-Date: Tue, 15 Oct 2013 08:56:34 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.java.help:2809 Hi, every one following are parameter set of my environment ///////////////// OS: Win 7 64 bit=20 Java: java version "1.6.0_29" 32 bit Test Printer: CutePDF Writer 2.8 =E3=80=81Microsoft XPS Document Writer /////////// I try to print a image to printer, while the image file size is small the r= esult is correct, but while the file is large (jpeg format about 1.4 MB) the result is blank!= ! I have assign -Xmx1024m to JVM. following is the code to print, can any one give some suggestions=20 /////////////// public class TestPrinter2 { public static void main(String[] args) throws Exception { PrintService service =3D PrintServiceLookup.lookupDefaultPrintService(); PrintRequestAttributeSet set =3D new HashPrintRequestAttributeSet(); set.add(new Copies(1)); PrinterJob pj =3D PrinterJob.getPrinterJob(); if (pj.printDialog(set)) { service =3D pj.getPrintService(); final BufferedImage img =3D ImageIO.read(new File("C:/TEMP/large.jpg")); DocFlavor inFlavor =3D DocFlavor.SERVICE_FORMATTED.PRINTABLE; Doc doc =3D new SimpleDoc(new Printable() { public int print(Graphics graphics, PageFormat pageFormat, int pageInde= x) throws PrinterException { if (pageIndex > 0) return Printable.NO_SUCH_PAGE; Graphics2D g2d =3D (Graphics2D) graphics; g2d.drawImage(img, (int)pageFormat.getImageableX(), (int)pageFormat.ge= tImageableY(), (int)pageFormat.getWidth(), (int)pageFormat.getHeight(),null= ); return Printable.PAGE_EXISTS; } }, inFlavor, null); DocPrintJob job =3D service.createPrintJob(); job.print(doc, set); } } } ////////////////// thanks for reply