I'm trying to develop a mini PDF library and I'm stuck on getting images into the PDF

using  to read just a simple  (camera generated picture)  jpg  file
        Bitmap  bmp;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        bmp.compress(CompressFormat.JPEG, 100 , bos);


How do I get this into the PDF format ?

currently this is what I have

                  "<<  /Type  /XObject  \n" +
                      "   /Subtype /Image \n" +
                        "   /Width  "  + bmp.getWidth()  + " \n" +
                      "   /Height  " + bmp.getHeight() + " \n" +
                      "   /ColorSpace  /DeviceRGB  \n" +
                      "   /BitsPerComponent  8  \n" +
                      "   /Length " + bos.size() + " \n" +
                      "   /Filter  /ASCIIHexDecode  \n" +
                      ">> \n" +
                      "stream \n" +
                      bos.toString() +  "\n" +
                      "endstream \n" +
                      "endobj \n\n";

1)  I think my  /Filter  is wrong  not sure what to use   ?
2) The test image is 341 x 256 => 87296 bos.size() returns 84156 and yet when I count the number of bytes between stream and endstream in the generated .pdf file I get 78814 ? What causes these changes ? 3) What is the /Filter equivalence for CompressFormat.JPEG and CompressFormat.PNG ?


Please any help to get from the bitmap to a displayed image in the PDF file would be greatly appreciated.

Thanks in Advance

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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

Reply via email to