tags:

views:

112

answers:

1

I'm in need of generating and viewing PDF/X-1a. After spending quite some time I came to the conclusion that the only way (hopefully someone will prove me wrong) to achieve this is to use Cocoa.

More context: I need to generate PDF/X-1a, that is, all the fonts embeded, spot colors, overprint, ... preferably from Python. But the only libraries which support such things are iText and perhaps and Apache FOP. The first one could be used with Jython, which is ok but not optimal.

But then, I simply could not find any viable viewer. Poppler, xpdf, Sumatra, mupdf, ghostscirpt - all of them - just cannot handle large CMYK pdfs, lots of text, ...

I really would like to use open sourced libraries but unfortuntatelly the only option I see right now is to buy Mac as I saw one could print (Save-as) to built-in PDF printer under PDF/X conformance and I expect Preview to be comparable, if not better, to Acrobat. But I'm not sure if is it even possible to programmatically access the MacOS libraries responsible for generating PDF? I'm asking because I heard not everything from MacOS is available via public API... (And what Python goes, I thought I could use PyObjC..?)

Any others ideas are of course very welcomed!

A: 

I would recommend Xpdf for rendering PDF to raster. It doesn't explicitly support PDF/X, in fact it doesn't use embedded ICC profiles at all. However, you could wrap it in your own code to retrieve the PDF/X OutputIntent profiles and write a custom OutputDev class to call littlecms (or similar library) to apply ICC color conversions and convert to RGB for display.

I was one of the authors of PDF/X and implemented the first preflight application for PDF/X-1a. Let me know if you specific help.

Dwight Kelly Apago, Inc. www.apagoinc.com

Dwight Kelly
You can't imagine how glad I'm I met somewhat from around PDF/X. First, PDF/X is the best, I'm telling you! Especially 1a! What rendering goes, I tried poppler (xpdf-based) and it really was unusable slow.
PhillipeTKern
But, please, I have several questions about PDF/X generation: 1. would it be difficult to write a Python library from scratch? I read PDF spec, so far the only real trouble is font embedding - do you have any recommendation in that direction? 2. Is possible to download PDF/X spec somewhere or do I have to buy it? 3. do the images also need to have embeded profile or is it enough to define it in OutputIntend? 4. If I want the printing house to do the trapping - should I set /Trapped to /False? 5. Do you know of any open source software / libraries where I could look inside how things work?
PhillipeTKern
There are several Python libraries for creating PDF files. It wouldn't be to difficult to modify them to write PDF/X-1a -- if you control what elements are created. For example, you couldn't place a RGB JPEG into the PDF if the OutputIntent indicates the file is SWOP CMYK. The colors of the images would have be modified to CMYK first. Also, fonts have to be embedded.ISO sells the PDF/X specification. It can't be distributed for free. Images in PDF/X-1a can't have profiles (ICCBased colorspace). If you want PDF/X-3 then you can use ICCBased images.Trapped key is universally ignored
Dwight Kelly