Is there a way to use ghostscript to convert PDF to PDF/A or PDF/X? I know it can be used to convert PDF to images, but I don't know if it can be used to convert PDF/A. What parameters should I use?
相关问题
- Correctly parse PDF paragraphs with Python
- Set BaseUrl of an existing Pdf Document
- How can I get all text from a PDF in Swift?
- Renaming named destinations in PDF files
- Write multiple lines of text in a flow with report
相关文章
- Python Sendgrid send email with PDF attachment fil
- C# MVC website PDF file in stored in byte array, d
- How To Programmatically Enable/Disable 'Displa
- How to reduce PDF file size programmatically in Ja
- Search and replace placeholder text in PDF with Py
- ITextSharp 4.1.6. PDF Table - how to remove whites
- jsPDF justify text
- Doc4j - Having issues converting docx to PDF with
Hope this answer helps others coming from Google with the same problem:
To convert from PDF to PDFA-1b or PDFA-2b, you can use Ghostscript. I suggest you use the latest version (9.19 today).
Install it
In Mac OS, you may prefer to use homebrew:
In Linux, some distros bring a much older version (rhel7 sports 9.07). To download a fully independent modern one-file-only ghostscript, download it directly from the site:
If the link above is broken when you try it 20 years from now, please refer to ghostscript.com and search for download section. Download the binary version, don't go for the source, unless you know what you are doing.
In Windows, I cannot help you, but if you manage to install it, the following commands will also work, if you substitute the location of files and gs executable.
Command line
Please note that
output_file.pdf
andinput_file.pdf
must be changed to the names of the output file (the converted file) and the input file (the file to be converted)./path/to/PDFA_def.ps
is your copy of the filePDFA_def.ps
.-dPDFA=1
is for PDFA-1b.-dPDFA=2
if you want PDFA-2b.What is
PDFA_def.ps
?PDFA_def.ps
is some sort of template ghostscript uses to create a PDFA file. The tricky part is that, for some reason, ghostcript comes with a non-working file.You'll need to edit
PDFA_def.ps
and include the path to a valid ICC (color profile) file. Download a good color profile from Adobe:Inside that zip, find a file called
AdobeRGB1998.icc
, put it somewhere and put the path to that file in you PDFA_def.ps file.Here is a version of PDFA_def.ps, change
PATH_TO_YOUR_ICC_FILE
to the path of you AdobeRGB1998.icc.https://gist.githubusercontent.com/weltonrodrigo/19df77833f023fbe1572168982e4b515/raw/ea86e87379d14120d7ff26f6f235ac7eeb5f5dd5/PDFA_def.ps
If you're using Windows and want to create PDF/A-1b documents explicitely (PDFCreator has an output option for PDF/A-2b but not for PDF/A-1b), you just can enter the parameters Artur described above into the ui settings of PDFCreator without the ones for the document names. Start PDFCreator, choose the printer menu, then go to settings. Now, choose
'Ghostscript'
from the settings list on the left side. Under'additional ghostscript settings'
, enter as follows :Click on
'Save'
, then print something from MS Word or any other application you want using the PDFCreator - it will be created in PDF/A-1b.Greetings, Fritz
This is to convert a pdf document (not pdf/a) into pdf/a:
gs -dPDFA -dBATCH -dNOPAUSE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=output_filename.pdf input_filename.pdf
Hope this will help some one!
@danio, @imgen: Even recently released documentation pages on PDF/X (standardized Prepress requirements) and PDF/A (standardized Archiving requirments) generation were quite misleading. (Your link pointed to a v8.63 release.) In the end, it suggested that running the example commandlines using the sample
PDF*_def.ps
would already generated valid PDF/A and PDF/X files.But, they do not!
Here is one of the sample commands, which by itself is correct:
The output file will declare itself to be PDF/A (and most PDF viewers would happily go along with this), but the output file fails all real compliance tests.
The fix is easy: you need to edit your sample
PDFA_def.ps
(for PDF/X: yourPDFX_def.ps
) files to match your environments. These required edits were not clearly spelled out in older documentation versions, and the provided command suggested it would work out of the box.Especially in case of PDF/X you MUST specifiy a valid ICC profile to use.
See also the updated documentation (current SVN trunk version) about this: