How do I convert images (PSD, AI and EPS) to PDF?

2019-03-31 03:46发布

问题:

Customers of my Django site can upload a print design in: PDF, PSD, AI and EPS. If the filetype they upload is not PDF I want to convert it to PDF.

So my question is: How do I convert Photoshop, Illustrator and CorelDraw files to PDF (programmatically)?

I tried UniConvertor but it: does not support PSD, distorted my AI inputs, and rejected my EPS inputs. Know any workarounds?

I am open to running separate scripts for each filetype. I googled "psd to pdf" but the results all looked like spam. (It seems image conversion is a cottage industry.) Ideally I want open-source but I will take what I can get.

The reason I want everything in PDF is so I can draw bleed lines using ReportLab and return a "proof" to the customer. Also the printing company I use requires PDF.

Thoughts? Suggestions?

回答1:

Photoshop is going to be a tough one, as is Adobe Illustrator. I'm unaware of any kind of command line utility that will export those to PDF. EPS is Encapsulated Post Script, meaning you may have some luck if you grab a copy of GhostScript. It'll depend on how the EPS was created though, and I'd consider it iffy at best.

Corel Draw, AFAIK, is proprietary. I know that you can export the file to PDF from within their program, but I am not aware of any kind of command like utility to accomplish the same (I also worked for a printing company, so I'm fairly familiar with the formats you're referring to).



回答2:

One solution that does support all of those formats, as well as exporting to PDF, is Gimp. In addition, you can script Gimp with Python.

http://www.gimp.org/docs/python/index.html

It sounds like you can install arbitrary software on the Django server, so as long as you have access to the X server (GUI) this is possible.