views:

587

answers:

3

So I'm working on a CMS module for a newspaper site. I'm enabling the editors with the option to upload a PDF of the entire newspaper, which will then be converted into a page-flipping digital online newspaper.

The page-flipping trick is done with flash and is just an .swf that I use for all the editions. My problem is with the PDF 2 JPEG conversion.

These PDFs are done in Adobe InDesign CS4, and most of the times contain Images that have effects like Dropshadows or Bevels.

I initially tried my code out with PDFs that had only text or simple images in them.. and things worked fine. When I tried this out with more complex PDFs, which included rotated images with dropshadow effects, things got tricky.

Here is my ghostscript code:

$result=exec("gs -sDEVICE=jpeg -sOutputFile=../ediciones/20090717/pages/page-%d.jpeg ../ediciones/20090717/20090717.pdf");

Here are all the links you'll need: www.dengelz.com/clientes/norte/ghostscript.html

Suggestions?

+1  A: 

I have the suspect that what gs does is to convert the pdf into the same datamodel that supports postscript. Postscript does not support transparency (alpha channel), so there's no way to represent the drop shadows in this intermediate format. Then, gs renders the jpg, obviously with no trasparencies.

I think you will have to use another strategy to convert your pdfs to jpg.

Stefano Borini
A: 

Any suggestions on what will work here?

I tried imageMagik but it generates a blank JPEG (just white).

A: 

Problem resolved.

It had to do with the way the PDFs were being exported from Adobe InDesign CS4.

The correct format for this export is:

  • Standard: PDF/X-3:2003
  • Compatibility: Acrobat 4 (PDF 1.3)
  • Output - Color : No Color Conversion
  • Output - PDF/X: Document --> (whatever space the document has)
  • Advanced - transparency flattener: [Medium Resolution]

A couple of these configurations I have no idea what they are, but this is the configuration that worked for the correct export of the PDFs, and conversion into JPEG (dropshadow included).

From what I understand, with this configuration, there is a Flattening process that happens before the PDF is generated, therefor saving Ghostscript the trouble of having to interpret transparency.

You can now check the generated JPEG here: http://www.dengelz.com/clientes/norte/ediciones/20090717/pages/page-1.jpg