I've build an applet to properly manipulate and visualize TIFF images in browsers (manipulate means to rotate, zoom, an multitiff support). The applet receive base64 string representation of the TIFF image and show it to the user properly using JAI API. The applet keep the image without any transformation (as a RenderedImage), and all operations (rotate, zoom) are kept in another Object (RenderedOp).
I want to implement a print function that allows the user to print the TIFF image kept in the applet, but when i print the image, only a portion of the image is printed because the image is to big. I tried to scale the image to fit the page size, but when printed, the image is not showed properly (image lost quality). After that, i tried to save the image into a file, to check if the image, when coded and decoded to a Base64 string representation, was losing quality. After save the image, i printed it using an image viewer (Ubuntu Image Viewer is the one i am using), but when printed from the image viewer, the printout was correct (the image was fitted in the paper without lose quality).
¿How can i print an image bigger than paper size without lose quality?
¿Am i doing the wrong operation to the image to fit the page? (scale operation in this case).
Below i put the code of the print method (implemented in a Printable Object) that is used to print the image. In this code the image is scale to fit the page.
Any comments or suggestions are welcome. Thanks in advance for your help.
Well, after a lot of work i've discover that the printout image has poor quality because PrintJob Object by default set page dimension for 72 DPI. Now my problem is to properly change that value. Below i show the code i'm using to do it, but is not working.
Now the real problem for me is to properly change DPI attribute ..
-¿What was wrong?-
I was scaling the image (RenderedImage) Object.
Keep the original image (without scale) and scale the Graphics2D object before draw image on it. After that the image is automatically adjusted to Graphics2D object and correctly printed (using best DPI configuration). Below i add the correct code to properly print an RenderedImage Object.