Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: Embedded jpeg image
Conf: (P-PDF) Developers, Msg: 90669
From: billb2112
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
/Filter /DCTDecode
/Height 301
/Length 17464
/Type /XObject
/ColorSpace /DeviceRGB
/Width 388
/Name /Im0
/Subtype /Image
/BitsPerComponent 8


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.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.