I'm developing a "paperless" workflow and plan to save all files in PDF/A-1b format.
I'm trying to develop a simple batch file for converting PDF files that I create or receive to PDF/A-1b. Starting from this answer, I have the following batch file:
gswin32c ^ -dPDFA ^ -dNOOUTERSAVE ^ -sProcessColorModel=DeviceCMYK ^ -dUseCIEColor ^ -sDEVICE=pdfwrite ^ -o %2 ^ -dPDFACompatibilityPolicy=1 ^ "C:\Program Files (x86)\gs\gs9.07\mylib\PDFA_def.ps" ^ %1
In PDFA_def.ps, I've tried a few different ICC profiles, including one I found on my system
sRGB_IEC61966-2-1_no_black_scaling.icc from color.org.
My test input file is a 1-page email printed from Microsoft Outlook 2010 using CutePDF 2.8 (which uses Ghostscript 8.15).
After converting with my batch file and Ghostscript 9.07, Adobe Reader thinks the output is PDF/A, but PDF/A-1b validation by pdf-tools.com fails with the message "The value of the key N is 4 but must be 3."
I have traced this back to the following construct in the PDF output file:
<</Filter/FlateDecode /N 4/Length 2595>>stream
If I change
/N 4 to
/N 3, the "value of key N" message goes away.
/N apparently represents the number of objects in the stream that follows this header. I don't know how to read the encoded stream so I don't understand what it contains nor why pdf-tools thinks it must only contain 3 objects.
A PDF/A printed using Bullzip, which also uses Ghostscript, also fails validation with the "key N is 4 but must be 3" message.
Does this have something to do with the color space? I'm out of my depth there. I think I'd be happy with a "plain" sRGB space. Ghostscipt docs say the PDF/A encoding must be CMYK. Adobe implies that either RGB or CMYK works for PDF/A. So I'm unclear about how to find an appropriate .icc profile.
Or maybe the validator is wrong and everything is fine?