Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 3rd, 2008, 1:37 AM   #1
zakisaadeh
Newbie
 
Join Date: Mar 2008
Location: Austin, TX
Posts: 2
Rep Power: 0 zakisaadeh is on a distinguished road
PDF to JPEG

Hey,

I want to write in a program in C++ that converts a one-page PDF document into a JPEG. How would you approach this problem?

Thanks,
Zaki
zakisaadeh is offline   Reply With Quote
Old Mar 3rd, 2008, 3:02 AM   #2
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 748
Rep Power: 3 Jimbo is on a distinguished road
Re: PDF to JPEG

I would look if there's a library somewhere to convert PDFs to JPGs. Failing that, I would look for two libraries, one to convert PDF to ImageFormatX, and one to convert ImageFormatX to JPG. Replace ImageFormatX with the file format for which the required libraries exist.

Failing to find a suitable format for the conversion, well, I'd hope it would not require resorting to reading format specs (ugly things, those). Maybe look for a way to get a thumbnail of the PDF through a print-preview like function?

Sorry for the lack of helpfulness. Finding such libraries may be easier with another language as well. Are you stuck with C++ from existing constraints? There may be libraries that allow the multi-step process if you cobble together a solution in a different language (or two).
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote
Old Mar 3rd, 2008, 4:13 AM   #3
zakisaadeh
Newbie
 
Join Date: Mar 2008
Location: Austin, TX
Posts: 2
Rep Power: 0 zakisaadeh is on a distinguished road
Re: PDF to JPEG

Quote:
Originally Posted by Jimbo View Post
I would look if there's a library somewhere to convert PDFs to JPGs. Failing that, I would look for two libraries, one to convert PDF to ImageFormatX, and one to convert ImageFormatX to JPG. Replace ImageFormatX with the file format for which the required libraries exist.

Failing to find a suitable format for the conversion, well, I'd hope it would not require resorting to reading format specs (ugly things, those). Maybe look for a way to get a thumbnail of the PDF through a print-preview like function?

Sorry for the lack of helpfulness. Finding such libraries may be easier with another language as well. Are you stuck with C++ from existing constraints? There may be libraries that allow the multi-step process if you cobble together a solution in a different language (or two).
I have been looking for some C++ libraries but I still haven't found anything specific for my purpose. I thought I might not be looking enough and wanted to see if people have any idea of such a lib. I think I like your idea of the thumbnail of the page, in case I can't find a better solution.

I am constrained to C++ as my program will be part of a bigger project that uses C++.

Zaki
zakisaadeh is offline   Reply With Quote
Old Mar 3rd, 2008, 7:06 AM   #4
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Re: PDF to JPEG

I would find a PDF rendering engine like Poppler, and render internally to a buffer (like raw RGB bytes). Then you could use libjpeg to write the image to disk.
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF files in Delphi superseven Delphi 3 Jan 30th, 2008 8:05 AM
Non-English PDF Conversion to XML proaudience Other Web Development Languages 0 Jun 18th, 2007 1:33 PM
Jpeg Help qash C++ 2 Aug 30th, 2005 9:59 PM
JPEG decoding qash C++ 3 Aug 30th, 2005 9:50 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC