aljungberg Posted November 2, 2006 Share Posted November 2, 2006 I have a certain kind of report which is meant to be printed on a thermal label printer. I have created a report which is the right size, 4x6 inches, and added the single image which will be printed on the label. The PDF files generated are good but when printing straight from Jasper the report becomes distorted and gets a jagged dotted appearance. I have a hunch that Jasper is feeding the 200 DPI thermal printer a 300 DPI image (the original image file is 300 DPI), and that the thermal printer isn't doing a great job rescaling it to its own DPI. Does anyone have any experience with this? Is Jasper aware of the DPI of the printer it prints on? If a source image is a higher DPI than the printer takes, what kind of scaling, if any, does Jasper apply? If I print the PDF file generated using Acrobat Reader the result is perfect. So clearly there is some correct way to scale these images. I realize that I can just scale and send the image to the printer directly in this special case, but we need to support label printers for more general reports as well and would like to use Jasper. Anyone know anything about this? Link to comment Share on other sites More sharing options...
aljungberg Posted November 8, 2006 Author Share Posted November 8, 2006 Nobody? I tried printing a different report printer using the thermal printer with a similar jagged result. So I'm quite sure there is something with the DPI. Link to comment Share on other sites More sharing options...
aljungberg Posted February 17, 2007 Author Share Posted February 17, 2007 We have confirmed that sending an image file with the correct DPI to Jasper works fine. If you send a 203DPI image, the printout comes through fine. But if you send a 300DPI image, Jasper seems to try to print in 300 DPI even that the printer is not capable of handling that resolution. Is there any way to convince Jasper to print with the appropriate resolution for the given printer? Link to comment Share on other sites More sharing options...
teodord Posted February 19, 2007 Share Posted February 19, 2007 Hi, I think a solution would be to use a javax.print.attribute.standard.PrinterResolution instance as a print request parameter added to the PRINT_REQUEST_ATTRIBUTE_SET exporter parameter available for the JRPrintServiceExporter. Check the supplied /demo/samples/printservice sample to see how we force the printing on a ISO_A4 sized paper.You should be able to force the printer resolution in a similar way, using an instance of the PrinterResolution class added to the attribute set. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
aljungberg Posted March 4, 2007 Author Share Posted March 4, 2007 Thanks for the advice. I went ahead and added a resolution attribute, PrintRequestAttributeSet prattrs = new HashPrintRequestAttributeSet();prattrs.add(new PrinterResolution(203, 203, ResolutionSyntax.DPI));...printer.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, prattrs); This did not solve the jagged problem. What it did do was to disprove my theory that the printer itself is doing some kind of crazy scaling from 300 DPI to it native resolution and failing miserably. If I set the resolution to 75DPI I get a very small printout which none the less is just as jagged. The printer has no reason to scale a 75DPI printout. Then what's more likely is that Jasper is in fact scaling the image as it should. This is great news. But the printout is none the less jagged. Perhaps Jasper is doing some kind of bilinear scaling which results in a grayscale version of the image, which is then truncated to black and white by the printer? Link to comment Share on other sites More sharing options...
ChristophLeser Posted March 15, 2007 Share Posted March 15, 2007 Sorry, I can offer no help. But I'm very interested in printing to thermal printers with jasperreports.What platform are you on, windows or unix? And what is the brand of your printer, and what driver do you use?I could do some experiments on linux with either zebra or markpoint printers.Maybe you could post the report you are tring to print? Link to comment Share on other sites More sharing options...
ChristophLeser Posted March 15, 2007 Share Posted March 15, 2007 Sorry, I can offer no help. But I'm very interested in printing to thermal printers with jasperreports.What platform are you on, windows or unix? And what is the brand of your printer, and what driver do you use?I could do some experiments on linux with either zebra or markpoint printers.Maybe you could post the report you are tring to print? Link to comment Share on other sites More sharing options...
ChristophLeser Posted March 15, 2007 Share Posted March 15, 2007 Sorry, I can offer no help. But I'm very interested in printing to thermal printers with jasperreports.What platform are you on, windows or unix? And what is the brand of your printer, and what driver do you use?I could do some experiments on linux with either zebra or markpoint printers.Maybe you could post the report you are tring to print? Link to comment Share on other sites More sharing options...
aljungberg Posted March 16, 2007 Author Share Posted March 16, 2007 We're using Windows XP here. The printer is a Zebra LP2844 (UPS edition), with the latest UPS drivers. I could give you the report but it's basically just a single image in an appropriately sized single band report. Link to comment Share on other sites More sharing options...
aljungberg Posted March 16, 2007 Author Share Posted March 16, 2007 I updated to Jasper Reports 1.3.1 but the situation did not improve. Link to comment Share on other sites More sharing options...
aljungberg Posted July 27, 2007 Author Share Posted July 27, 2007 The same problem occurs on an industrial Z4M plus printer. I am beginning to suspect that Jasper somehow generates a 300 DPI image and then tries to scale it down to the printer resolution. The scaling introduces the artifacts which is the printer's attempt at drawing grey scales created by bilinear filtering. If there was some way to tell Jasper not to scale the image up to begin with this problem would not exist. The image is exactly the right resolution from the start. Or if Jasper could be told to use black and white scaling or generate a black and white document. Anyone got any ideas? Link to comment Share on other sites More sharing options...
paulo.alexandre88 Posted October 18, 2013 Share Posted October 18, 2013 Hi! this problem is resolved with you? 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