New Forum | Previous | Next | (P-PDF) Developers
Topic: Embedded jpeg image
Conf: (P-PDF) Developers, Msg: 90669
Date: 6/25/2003 06:20 AM
I've been writing a small in house PDF generator. I've now been asked to have the library (which is in C++) support embedding jpegs into the PDF file. I've done a search on previous threads and found some very good help on getting me over some previous humps, but now I can't seem to get past the final hump in displaying the image. When I open the document, and go to the page where I'm supposed to be displaying the image I receive a "There was a problem reading this document (20).". When I hold down control and hit OK I get the error "Expected a stream object". This lead me to believe that perhaps my xref table was off, but I verified with a hex editor that the exact locations were the beginning of objects.
I also read that jpegs are special and the whole file can literally be plopped into a stream byte for byte. This is what I did. Below is what my obj looks like:
10 0 obj
Another avenue I took was finding a utility that would take a jpeg and convert it into a pdf file and examine the output of that program. I noticed that the dictionary is identical to mine, however, upon very close examination, the bytes in the stream in my pdf begin to deviate from the bytes in the program that is doing it right. This leads me to believe that I cannot just simply plop the data in the pdf file and expect it to work. The thing that puzzles me even further is that the /Length in my object and the /Length in the working PDF object are identical, which is the exact size of the jpeg file. And the final, say, 20 bytes are identical to my generated pdf.
I'm out of ideas at this point. Any help would be appreciated.