Requirements:
Ghostscript 8.64 Only.
PDFBox 0.7.3
pdfmarks ( file to supply additional meta data)
PDFA_def.ps
USWebCoatedSWOP.icc
I converted the PDF to PDF/A running the following command:
gs -sDEVICE=pdfwrite -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFA -dUseCIEColor -sProcessColorModel=DeviceCMYK
-sOutputFile=Out_PDFA.pdf PDFA_def.ps pdfmarks IN_PDF.pdf
The PDF/A created is named OUT_PDFA.pdf
If you verify the file at this stage it will show that there are Annotation print flags that are not set for each hyperlink
To fix that problem, it is necessary to set the print flag in each link by using a Java program I wrote called "FixPrintFlag.java".
FixPrintFlag.java uses PDFBox library to acces each link and set the print flag in the PDF file.
running FixPrintFlag:
usage FixPrintFlag input_pdf output_pdf
so : java FixPrintFlag Out_PDFA.pdf New_verifiablePDFA.pdf
using Adobe, New_verifiablePDFA.
---\code for FixPrintFlag.java
****start******:
package org.pdfbox.examples.pdmodel;
import org.pdfbox.pdmodel.PDDocument;
import org.pdfbox.pdmodel.PDPage;
import org.pdfbox.pdmodel.common.
public class FixPrintFlag
{
public StringBuffer errMsg = new StringBuffer();
private FixPrintFlag()
{
//utility class, should not be instantiated.
}
public static void main( String[] args ) throws Exception
{
PDDocument doc = null;
try
{
if( args.length != 2 )
{
usage();
}
else
{
doc = PDDocument.load( args[0] );
List allPages = doc.getDocumentCatalog().
PDAnnotationLink link = (PDAnnotationLink)annot;
link.setPrinted(true);
System.out.println("setting print flag...");
}
}
}
}
if (args[1] != null)
doc.save(args[1]);
} catch (Exception ex) {
System.err.println("Error parsing pdf: " + ex.getMessage());
}
}
private static void usage()
{
System.err.println( "Usage: java org.pdfbox.examples.pdmodel.
}
}
******end code********************
______________________________
pdfmarks can be used to supply MetaData..date and times left out intentionally.
contents:
[ /Title (Document title)
/Author (Author name)
/Subject (Subject description)
/Keywords (comma, separated, keywords)
/Creator (application name or creator note)
/Producer (PDF producer name or note)
/DOCINFO pdfmark
______________________________
NOTE: don't try gs v 8.70 , it will error out early even if the pdf was modified by FixPrintFlag. Ther appears to be a bug in v8.70.
GPL Ghostscript 8.70: Annotation set to non-printing,
not permitted in PDF/A, reverting to normal PDF output
NOTE: It will work for gs v 8.71...
note on 8.71 , run the FixPrintFlag on the input pdf
then take the output from FixPrintFlag and use that as the input to gs 7.1
command above
the file that you get out from gs will verify as a valid PDF/A using Adobe.