Those methods are informative and depend on the information in the
image. You still have to scale, based or not in what you get from those
methods.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, November 08, 2005 10:01 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] iText Newbie question: The image resolution
> 
> Hi Everybody, 
> 
> I am just a newbie here who is trying to use the iText for 
> some PDF related functions in my development job. Here I got 
> some questions about how the iText handle about the image 
> storage inside the PDF file:
> 
> From the iText tutorial, it mentioned: "Remark that the 
> resolution of an image that is added without scaling will be 
> 72dpi by default. If an image is placed with a scaling of 50% 
> the the resolution will be 144. With lower scalings the 
> resolution will increase because the pixels are the same but 
> the size will be smaller. To put a picture with 300dpi use a 
> scaling of 72/300=24%. For instance: if you have a 5X5 inch 
> image that you scan at 300 dpi, the resultant image is 
> 1500X1500 pixels (5X300 = 1500). When you place this image in 
> the pdf with a scaling of 24% (72/300 = 0.24), the image in 
> the pdf will be 5X5 inch with 1500X1500 pixel at 300 dpi. The 
> image will always be 1500X1500 pixel whatever the size. "
> 
> As my understanding, which means the resolution dpi of the 
> image will only be decided by the original image source data 
> as well as the size scaling of the display area of that image 
> in the generated PDF file.
> 
> But I am also wondering how can I adjust the resolution if needed. 
> Seems the com.lowagie.text.Image class has the Method of 
> "setDpi()" and also methods for retrieving the dpi info, 
> which are "getDpiX()" and "getDpiY()"; 
> 
> I've write some codes to see how those methods work, which as 
> following:
>                         
>                         Image jpg = Image.getInstance("test.jpg"); 
>                         System.out.println("Original Dpi: 
> x="+jpg.getDpiX()+" y="+jpg.getDpiY());                       
> 
>                         jpg.setDpi(500,500); 
>                         System.out.println("After Setting 
> Dpi: x="+jpg.getDpiX()+" y="+jpg.getDpiY()); 
>                         jpg.scalePercent(50f); 
>                         System.out.println("After Scaling 
> Dpi: x="+jpg.getDpiX()+" y="+jpg.getDpiY()); 
>                         
>                         document.open(); 
>                         document.add(jpg); 
> 
> However, the output result kind of confused me about the 
> idea. Because it seemed that the "setDpi()" Method will 
> change the values of "getDpiX()" and "getDpiY()", and the 
> "scalePercent()" method has nothing to do with the results of 
> those two methods, besides, no matter what dpi value I set 
> with the "setDpi()" Method, the generated PDF file size will 
> be just the same. 
> 
> If anybody can give a clear explanation on this issue, that 
> will be really appreciated! 
> 
> Thank you very much! 
> 
> 
> Best, 
> 
> Han 
> [EMAIL PROTECTED] 
> No.   86-756-3398808 
> 
> 
> IMPORTANT NOTICE
> Email from OOCL is confidential and may be legally 
> privileged. If it is not intended for you, please delete it 
> immediately unread. The internet cannot guarantee that this 
> communication is free of viruses, interception or 
> interference and anyone who communicates with us by email is 
> taken to accept the risks in so doing. Without limitation, 
> OOCL and its affiliates accept no liability whatsoever and 
> howsoever arising in connection with the use of this email. 
> Under no circumstances shall this email constitute a binding 
> agreement to carry or for provision of carriage services by 
> OOCL, which is subject to the availability of carrier's 
> equipment and vessels and the terms and conditions of OOCL's 
> standard bill of lading which is also available at 
> http://www.oocl.com.
> 
> 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to