View Full Version : Using PHP to convert PDFs


joedevon
06-25-2009, 02:17 PM
I'm a new PRS 505 owner. I'd love to do a good job converting PDFs to a suitable format.

I notice there are PDF functions (http://us3.php.net/manual/en/book.pdf.php) in PHP. I haven't had a chance to study the options yet, but if it allows you to read the file and manipulate it properly, perhaps we can write some code together on this thread to serve as a solution for various problems?

For example, I have technical PDFs where tabbing is important. Calibre transfers the files by stripping the tabs which makes code hard to read. I'd like to turn a tab into 4 spaces instead. Don't know of a tool that will do it...

If this effort proves successful, and I get some extra time, I may put up a little site with a front end so non-technical people can select the options they desire right on the web and get the file they want.

Does this sound feasible and interesting to people?

frabjous
06-29-2009, 06:21 PM
Certainly investigating PDF functions in PHP is worthwhile, and what you describe sounds like a great resource, but why would you use calibre to convert technical PDFs? Surely, you'd be better off using something like PDFLRF (http://www.mobileread.com/forums/showthread.php?t=13135) or SoPDF (http://www.mobileread.com/forums/showthread.php?t=32066) for such documents, no? (No worries about losing your tabs there!)

joedevon
06-29-2009, 08:35 PM
Certainly investigating PDF functions in PHP is worthwhile, and what you describe sounds like a great resource, but why would you use calibre to convert technical PDFs?

Because I didn't know what I was doing :)
Finally getting some good results from soPDF except for the bookmark thing...
I have 30 days w/ the trial version to add bookmarks w/ Adobe but hopefully will find a better solution. Would be crazy to spend more on Acrobat than the Sony Reader just for bookmarks!

Surely, you'd be better off using something like PDFLRF (http://www.mobileread.com/forums/showthread.php?t=13135) or SoPDF (http://www.mobileread.com/forums/showthread.php?t=32066) for such documents, no? (No worries about losing your tabs there!)

Definitely :)

frabjous
06-29-2009, 10:09 PM
Well the source code for SoPDF is available, though I don't think it's in a programming language I know. Perhaps someone who did could look into the possibility of preserving bookmarks. Or perhaps the basic algorithm could be ported to php and tweaked. It's worth checking out.

HarryT
07-04-2009, 11:06 AM
"Book Designer" does the best job of converting PDFs of anything I've tried. Calibre is an excellent tool, to be sure, but PDF conversion is not one of its strengths.

Jill74
07-05-2009, 10:50 PM
I'll read more about this Calibre so that I can do experiments on converting Pdf files.