java - Image getting printed with low resolution -


i have requirement create pdf images printing. adding high resolution image pdf using itext. it's reducing quality 72 dpi. resulting in poor quality of image after printing.

the original image resolution 2549*3304 , dpi (300).

i tried below options

image.scaleabsolute(2549*.24 ,3304*.24 );   image.setdpi(300,300);       image.scaletofit(2549*.24 ,3304*.24 ); 

current code looks this

document document = new document(pagesize.letter);  document.open();  image image = image.getinstance("c:/project/bg.png");  image.setabsoluteposition(0,0);  image.scalepercent(24);  document.add(image);  document.close(); 

i went through threads (adding image pdf using itextsharp , scale properly) still not able solve problem

can please me on better image quality while printing?

the setdpi() method irrelevant in code, dpi of original image. pixels treated points in itext. means adding image as-is result in having 72 pixels per inch.

you scale image 24 percent of original size. means increase resolution: showing same number of pixels using 24% of space. in case, showing 2549 pixels distributed on 611.76 points. 8.5 inch, means indeed have resolution of 300 dpi.

i think problem isn't caused resolution of image inside pdf (but it's hard tell because can't inspect pdf). think problem caused printing process prints document using resolution different resolution in pdf.

in case: itext not reduce number of pixels if use methods scalepercent(), scaleabsolute() or scaletofit().

extra info based on comments:

asking pdf "resolution" doesn't make sense, because pdf doesn't have resolution (although images inside pdf may have one). have no idea why photoshop tells resolution 72 dpi. maybe that's default value because measurment unit in pdf corresponds point , there 72 points in 1 inch.

i have examined pdf shared. don't see loss of resolution when @ on screen. can see document measures 8.5 11 inch. image, please take @ report generated acrobat:

enter image description here

it says width/height: 2550/3300 in pixel.

2550 / 8.5 = 300

3300 / 11 = 300

hence resolution 300 pixels per inch. or: pdf created way want it.

however: resolution worse when print document. can caused many different things: maybe you're printing on page larger 8.5 11 inch, maybe printer can't print @ resolution, maybe pdf viewer can print using "degraded printing",...

my advice test pdf on different printers using different viewers find culprit.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -