Your TIFF is broken but I added a check in iText to take care of this
case.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, January 17, 2007 9:58 PM
> To: [email protected]
> Subject: [iText-questions] gettting exception on getTiffImage
> 
> Hello,
> 
> I am getting an exception with a tiff file when trying to issue the
> getTiffImage method.  Here is a simple program:
> 
> 
> import com.lowagie.text.Image;
> import com.lowagie.text.pdf.RandomAccessFileOrArray;
> import com.lowagie.text.pdf.codec.TiffImage;
> 
> /*
>  * Created on Jan 17, 2007
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> 
> /**
>  * @author shawn
>  *
>  * TODO To change the template for this generated type 
> comment go to Window
> -
>  * Preferences - Java - Code Style - Code Templates
>  */
> public class TestiText {
> 
>     /**
>      *
>      */
>     public TestiText() {
>         super();
>         // TODO Auto-generated constructor stub
>     }
> 
>     public static void main(String[] args) {
> 
>         try {
> 
>             RandomAccessFileOrArray ra = new 
> RandomAccessFileOrArray("c:
> \\temp\\0017BC11.tif");
>             //RandomAccessFileOrArray ra = new 
> RandomAccessFileOrArray("c:
> \\temp\\001EE318.tif");
>                System.out.println(TiffImage.getNumberOfPages(ra));
>                Image thePage = TiffImage.getTiffImage(ra,1);
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
> 
> Here is the output:
> 1
> java.lang.ClassCastException: java.lang.Object
>       at
> com.lowagie.text.pdf.codec.TIFFField.getAsRational(TIFFField.java:445)
>       at 
> com.lowagie.text.pdf.codec.TiffImage.getDpi(TiffImage.java:86)
>       at
> com.lowagie.text.pdf.codec.TiffImage.getTiffImage(TiffImage.java:158)
>       at
> com.lowagie.text.pdf.codec.TiffImage.getTiffImage(TiffImage.java:107)
>       at TestiText.main(TestiText.java:36)
> 
> Here is the image:
> (See attached file: 0017BC11.tif)
> 
> 
> Why does this happen?
> 
> Shawn
> 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to