One way would be to stuff all that information into a java.awt.Image, and we can convert that to a com.itextpdf.text.Image.
com.itextpdf.text.Image iTextImage = com.itextpdf.text.Image.getInstance(myAWTImage); You can also build an iText Image directly: Image img = new ImgRaw(width, height, components, bpc, byteData); "components" must be 1, 3, or 4 for gray, rgb, and cmyk respectively. "bpc" must be 1, 2, 4, or 8. If your data is in some other format (5 bpc, rgb + alpha, whatever), you'll have to manually translate those bytes into something iText will handle. The data is required to be aligned thusly: [quote "PDF Spec, 8.9.3 'Sample Representation'"] Sample data shall be represented as a stream of bytes, interpreted as 8-bit unsigned integers in the range 0 to 255. The bytes constitute a continuous bit stream, with the high-order bit of each byte first. This bit stream, in turn, is divided into units of n bits each, where n is the number of bits per component. Each unit encodes a colour component value, given with high-order bit first; units of 16 bits shall be given with the most significant byte first. Byte boundaries shall be ignored, except that each row of sample data shall begin on a byte boundary. If the number of data bits per row is not a multiple of 8, the end of the row is padded with extra bits to fill out the last byte. A conforming reader shall ignore these padding bits. [/quote] Basically, each row must end on a byte boundary, and you need to pad a row with extra bits if need be. "8 bpc" makes that quite irrelevant, but the other bpc values may require padding depending on the width of your image. Have Fun. :/ --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: sam_dev [mailto:[email protected]] > Sent: Monday, December 27, 2010 8:32 PM > To: [email protected] > Subject: Re: [iText-questions] How to convert PPMimage to bmp > or jpeg images...??? > > > hi.... > thanks for your reply....if i have information about > the bpc,height,width of the actual image than whats the way > to arrange those colored bytes in proper image format...???? > -- > View this message in context: > http://itext-general.2136553.n4.nabble.com/How-to-convert-PPM- > image-to-bmp-or-jpeg-images-tp3162969p3165689.html > Sent from the iText - General mailing list archive at Nabble.com. > > -------------------------------------------------------------- > ---------------- > Learn how Oracle Real Application Clusters (RAC) One Node > allows customers to consolidate database storage, standardize > their database environment, and, should the need arise, > upgrade to a full multi-node Oracle RAC database without > downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Many questions posted to this list can (and will) be answered > with a reference to the iText book: > http://www.itextpdf.com/book/ Please check the keywords list > before you ask for examples: http://itextpdf.com/themes/keywords.php > > ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
