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: Embeding JPEG images in PDF file generation
Conf: (P-PDF) Developers, Msg: 75406
From: Ramana
Date: 10/31/2002 02:56 AM

Hello,

I am working on an application which dynamically generates PDF document using user inputs and the data stored in the database (Images, Text Paragraphs, etc). The current application is supporting Images in BMP (ASCII85BASE decoding) format.

New requirement is to modify the application to support the JPEG and GIF image formats (along with BMP) in PDF file to keep the generated PDF file size small.

The following is the code used for inserting a BMP image in the current code.
o The ls_PDFstream is a stream object created by C++ code.
o The object this->il_imageWidth contains the image width (which is maintained in the database)
o The object this->il_imageHeight contains the image height (which is maintained in the database)
o this->inv_image->of_get_imageData()- This function returns the image data retrieved from database as a string

ls_PDFstream = "BI\r\n"; // beginning of Image data
ls_PDFstream += "/W "; // width of Image
ls_temp.Format("%d", this->il_imageWidth); // converts the integer to string and
// append to the ls_PDFstream
ls_PDFstream += ls_temp;
ls_PDFstream += CString("\r\n");
ls_PDFstream += CString("/H "); // height of Image
ls_temp.Format("%d", this->il_imageHeight); // converts the integer to string and
// append to the ls_PDFstream
ls_PDFstream += ls_temp;
ls_PDFstream += CString("\r\n");
ls_PDFstream += CString("/BPC 8"); // bits per component
ls_PDFstream += CString("\r\n");
ls_PDFstream += CString("/CS /RGB"); // color space
ls_PDFstream += CString("\r\n");
ls_PDFstream += CString("/F /AHx");
ls_PDFstream += CString("\r\n");
ls_PDFstream += CString("ID");
ls_PDFstream += CString("\r\n");

// get the image data in a string Retrieved from the database)
CString temp = CString(this->inv_image->of_get_imageData());
ls_PDFstream += temp;

ls_PDFstream += CString(">");
ls_PDFstream += CString("\r\n"); // EOD marker
ls_PDFstream += CString("EI");
ls_PDFstream += CString("\r\n");



In the same way as above code sample I need help in placing a JPEG image in the PDF document.

The following are the details needed for this...

How to convert a JPEG/GIF image to some decoded format (if required?) to place in the database so that it can be retrieved later to use with in PDF file generation?

How to get the height / Width / Color Space / Bits per component details from a JPEG image to specify in PDF creation.

Is there any C++ library available for the same?

Help!! Thanks in advance


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

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
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.

Features

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.