i using jasperreports print java application. prints ok costumers quite bit of time, have installed software couple of costumers have konica minolta pagepro 1200 or 1350w printers. , costumers same result - printing "stretched" - if printed a4 report on a5 paper. except printing a4 on a4 , on other printers works fine.
does have idea might cause?
this questions seems similar https://stackoverflow.com/questions/15854722/jasper-report-printing-stretched workaround presented there (messing printer paper size etc.) did not lead desired result.
here example of print:

and print should (there slighlty different data, guess problem clear)

thanks suggestions.
edit:
the issue can reproduced simple direct call printing api:
import java.awt.*; import java.awt.print.book; import java.awt.print.pageformat; import java.awt.print.paper; import java.awt.print.printable; import java.awt.print.printerexception; import java.awt.print.printerjob; /** * * @author mace */ public class printtest { static printable printable = new printable() { @override public int print(graphics graphics, pageformat pageformat, int pageindex) throws printerexception { graphics2d grx = (graphics2d)graphics; grx.drawline(20,20, getpagewidth() / 2, 20); return printable.page_exists; } }; protected static int getpagewidth() { //width of a4 in 1/72 of inches return 595; } protected static int getpageheight() { //height of a4 in 1/72 of inches return 842; } public static void main(string args[]) throws printerexception { frame f = new frame(); f.show(); //build buggy print job using printerjob class printerjob printjob = printerjob.getprinterjob(); /** * fix bug id 6255588 sun bug database */ try { printjob.setprintservice(printjob.getprintservice()); } catch (printerexception e) { } pageformat pageformat = printjob.defaultpage(); paper paper = pageformat.getpaper(); printjob.setjobname("buggy output"); pageformat.setorientation(pageformat.portrait); paper.setsize(getpagewidth() , getpageheight()); paper.setimageablearea( 0, 0, getpagewidth(), getpageheight()); pageformat.setpaper(paper); book book = new book(); book.append(printable, pageformat, 1); printjob.setpageable(book); if (printjob.printdialog()) { printjob.print(); } //build print job using printjob class printjob pjob = f.gettoolkit().getprintjob(f, "good output", null); if (pjob!=null) { graphics g = pjob.getgraphics(); g.drawline(20, 20, pjob.getpagedimension().width / 2, 20); pjob.end(); } system.exit(0); } } now code produces 2 prints on printers both print line top left corner of paper middle of paper. on aforementioned printers first print creates thick line across whole paper (200% scale) - second variant ok on minolta printers.
seems java bug, since other programs print printer. bug accepted sun, closed not hands on correct printer (https://bugs.openjdk.java.net/browse/jdk-804159)
is platform windows/mac/linux?
i've had trouble printing label printers when print job's media hint did not communicate through driver. similar problem, stretched prints, skipped pages etc,.
i dont know if have code modify, had switch system printing instead of java printing. system printing settings, (windows spooler in case), had create printer exact driver settings needed print properly. can in jasperreports other specify width/height/orientation.
i assume report prints fine when saved pdf, print pdf viewer.
Comments
Post a Comment