technotrans Posted December 6, 2007 Share Posted December 6, 2007 hi there... I want to print a report on a thermo transfer printer and i think i have to specify the dimensions of the label so that so printer makes a feed to the correct position. The JasperPrint-Object has the methods setPageHeight(int h) and setPageWidth(int w). But what kind of dimension i have to specify in there? Is it mm or inch or pixel? Is it the right place at all? !!! HELP !!! :ohmy:Post edited by: technotrans, at: 2007/12/06 13:54 Link to comment Share on other sites More sharing options...
lucianc Posted December 7, 2007 Share Posted December 7, 2007 If you want a report having pages of a specific size, you should set the pageWidth and pageHeight attributes of the report template (JRXML). The attribute values are pixels, and JasperReports uses 72 dpi (i.e. pageWidth="72" means that the page will be 1 inch wide). HTH,Lucian Link to comment Share on other sites More sharing options...
rayzz04 Posted January 14, 2008 Share Posted January 14, 2008 Hi! If JP uses 72 dpi, then a standard A4(8.5" x 11") size document's height should be 72*11? I used the length 842 as well as I've seen on many google searches, and none of these work. I've even taken the height attribute out, and still doesnt work. It seems there is a max height value built into JP. The page's footer keeps printing much before the next page and then the next page starts on the first and this continues throughout the document I'm creating. Please help! Link to comment Share on other sites More sharing options...
lucianc Posted January 14, 2008 Share Posted January 14, 2008 First of all, 8.5" x 11" is not A4, but US Legal. The page footer will print at a location determined by the page height declared in the JRXML (and if you don't declare a page height, 842 will be used), and not at the bottom of the psychical page on which the report gets printed. It's not very clear what you are doing and how you're expecting JasperReports to work, you may want to describe your issue better. Regards,Lucian Link to comment Share on other sites More sharing options...
technotrans Posted February 18, 2008 Author Share Posted February 18, 2008 hello lucian...i'm still facing the same problem with my thermo printer. does jasper send a form feed after the print-job is done? the printer always performs a feed when the print-job is done... Link to comment Share on other sites More sharing options...
lucianc Posted February 21, 2008 Share Posted February 21, 2008 JasperReports uses the Java AWT print APIs to print a report as a pageable document. This makes perfect sense in the JR context, since JR reports are paginated documents. I assume that the AWT print classes issue a form feed after each printed page. If you need a different printing mechanism, you could implement it externally to JR or post a JR feature request. Regards,Lucian Link to comment Share on other sites More sharing options...
hirtz Posted March 13, 2008 Share Posted March 13, 2008 technotrans wrote:does jasper send a form feed after the print-job is done? the printer always performs a feed when the print-job is done... Facing sort of the same problem printing labels on fanfold paper(5x2" per label, 6 per "sheet") using a dot matrix printer we have come up with the following workaround/fix in JRPrintServiceExporter. We are still using jasperreports 1.3.3 but the problem seems to still exist with 2.04 and the "patch" should work as well(not much changed in that context as far as i know). As activating my jasperforge account generates an error message you'll have to live with a bit of code posted here for now. JRPrintServiceExporter.java, lines 133 and followingCode:JRPrinterAWT.initPrinterJobFields(printerJob); // [added code]JasperPrint jPrint = (JasperPrint) parameters.get(JRExporterParameter.JASPER_PRINT);Paper paper = new Paper();PageFormat format = new PageFormat();if (jPrint.getOrientation() == JRReport.ORIENTATION_LANDSCAPE) { format.setOrientation(PageFormat.LANDSCAPE); paper.setImageableArea(0,0,jPrint.getPageHeight(), jPrint.getPageWidth()); paper.setSize(jPrint.getPageHeight(), jPrint.getPageWidth());} else { format.setOrientation(PageFormat.PORTRAIT); paper.setImageableArea(0,0,jPrint.getPageWidth(), jPrint.getPageHeight()); paper.setSize(jPrint.getPageWidth(), jPrint.getPageHeight());}format.setPaper(paper);printerJob.setPrintable(this, format);// [/added code]// determining the print service only oncePrintService selectedService = (PrintService) parameters.get(JRPrintServiceExporterParameter.PRINT_SERVICE); This might as well(maybe even better) be added line 185 and following inside the loop instead but extensive testing generated exactly the results we expected so for now this works fine for us. ChrisPost edited by: hirtz, at: 2008/03/12 17:05 Link to comment Share on other sites More sharing options...
hirtz Posted March 13, 2008 Share Posted March 13, 2008 /snip maybe, just maybe one copy will do. ChrisPost edited by: hirtz, at: 2008/03/12 17:05 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now