The image in your RTF file is a PNG the Alternate image is a WMF8. The alternate image is causing the problem. I will look at the code and see what I can do, but I'm swamped this week.
I will send you a private message with an updated file that functions. Regards Howard Shank ----- Original Message ---- From: Kianoosh Raika <[EMAIL PROTECTED]> To: Post all your questions about iText here <[email protected]> Sent: Thursday, July 17, 2008 12:22:07 PM Subject: Re: [iText-questions] RFT importRtfFragment Thanks. I'll update to the latest and test it out. I attached the letter. I'm probably signing myself up for this, but a few test cases for these types of docs would be useful. :) -Kianoosh btw, the PdfStamper, PdfReader and AcroFields work like a charm with fillable PDF's. On Thu, Jul 17, 2008 at 8:25 AM, Howard Shank <[EMAIL PROTECTED]> wrote: > There was an issue in prior versions with importing RTF file with images. > This has been fixed in the current release. > iText 2.1.3 contains the fix. > > RTF Supports the following: > EMF, PNG, JPEG, Word 97-Word 2002 Picture, QuickDraw, OS/2 metafile, Windows > Metafile, DIB, Windows device-dependent bitmap > > iText Image supports: > JPEG, PNG, GIF, BMP, TIFF, WMF, PS > > iText RTFImage supports: > BMP, PNG, WMF, GIF and JPEG > > Can you post your input RTF file? > > Regards, > Howard Shank > > > > ----- Original Message ---- > From: Kianoosh Raika <[EMAIL PROTECTED]> > To: [email protected] > Sent: Thursday, July 17, 2008 1:23:57 AM > Subject: Re: [iText-questions] RFT importRtfFragment > > Hi, > > I think I have a related problem here. I'm trying to import a simple > RTF document that contains a logo (for context, I will then have to > add some dynamic content from my DB to the doc). I was given the > document as a base to start with, so I'm not sure of the type of the > image that iText doesn't recognize, but here's the code that gives me > the exception below: > > RtfDocument doc = new RtfDocument(); > RtfParser r = new RtfParser(); > ClassPathResource letter = new > ClassPathResource("/com/path/to/rtf/letterhead.rtf"); > r.importRtfDocument(letter.getInputStream(), doc); > > > java.io.IOException: The byte array is not a recognized imageformat. > at com.lowagie.text.Image.getInstance(Unknown Source) > at > com.lowagie.text.rtf.parser.destinations.RtfDestinationShppict.addImage(Unknown > Source) > at > com.lowagie.text.rtf.parser.destinations.RtfDestinationShppict.handleCloseGroup(Unknown > Source) > at com.lowagie.text.rtf.parser.RtfParser.handleCloseGroup(Unknown Source) > at com.lowagie.text.rtf.parser.RtfParser.tokenise(Unknown Source) > at com.lowagie.text.rtf.parser.RtfParser.importRtfDocument(Unknown Source) > at com.DaoTest.testCreateRtf(DaoTest.java:63) > > > For some reason Eclipse is not allowing me to step through the source > code (it can't figure out line numbers on its own), so it's slowing > down my debugging somewhat. > > fyi, ClassPathResource is a Spring class that helps get me the > InputStream that importRtfDocument requires. > > Is this issue related? How can I tell what the imageformat is and > what is a recognized image format I should convert the logo to? > > Thanks, Kianoosh > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Do you like iText? > Buy the iText book: http://www.1t3xt.com/docs/book.php > Or leave a tip: https://tipit.to/itexttipjar > > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Do you like iText? > Buy the iText book: http://www.1t3xt.com/docs/book.php > Or leave a tip: https://tipit.to/itexttipjar > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar
