Bug 699582

Summary: Hyperlink not retained during PDF to PDFA conversion (5596)
Product: Ghostscript Reporter: Rajiv <rajivrp>
Component: PDF WriterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED INVALID    
Severity: major    
Priority: P4    
Version: unspecified   
Hardware: PC   
OS: Windows NT   
Customer: Word Size: ---
Attachments: Sample file

Description Rajiv 2018-08-02 15:57:33 UTC
Created attachment 15403 [details]
Sample file

Hi,

While converting attached PDF to PDFA/1B, a hyperlink on Pg 3 isn't getting retained. We are using 9.06 but the issue is reproducible using latest version as well.

"C:\Program Files\gs\gs9.06\bin\gswin64c.exe" -dPDFA -dNOSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -dSubsetFonts=false -dEmbedAllFonts=true -dAlignToPixels=0 -dGridFitTT=2 -dCompatibilityLevel=1.4 -r300 -dPDFSETTINGS=/default -sDEVICE=pdfwrite -sOutputFile=C:\Documentum\CTS\cache\DOC3-1524772666.pdf PDFA_def.ps -- PDFcertificadoAntesloc.pdf

Can you please check ?

Thanks,
Rajiv
Comment 1 Rajiv 2018-08-02 16:01:24 UTC
"C:\Program Files\gs\gs9.06\bin\gswin64c.exe" -dPDFA -dNOSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -dSubsetFonts=false -dEmbedAllFonts=true -dAlignToPixels=0 -dGridFitTT=2 -dCompatibilityLevel=1.4 -r300 -dPDFSETTINGS=/default -sDEVICE=pdfwrite -sOutputFile=Output.pdf PDFA_def.ps -- Input.pdf
Comment 2 Ken Sharp 2018-08-03 09:26:51 UTC
If you bother to read the Ghostscript transcript while running the file through a *recent* version of Ghostsceript you will see:

GPL Ghostscript 9.23 (2018-03-21)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 4.
Page 1
Loading NimbusSans-Bold font from %rom%Resource/Font/NimbusSans-Bold... 4568716
3094288 2360944 989640 3 done.
Loading NimbusSans-Regular font from %rom%Resource/Font/NimbusSans-Regular... 46
34604 3258993 2381048 1012733 3 done.
Loading NimbusSans-Italic font from %rom%Resource/Font/NimbusSans-Italic... 4760
804 3438946 2401152 1031688 3 done.
Loading NimbusSans-BoldItalic font from %rom%Resource/Font/NimbusSans-BoldItalic
... 4967420 3634451 2421256 1045339 3 done.
>>showpage, press <return> to continue<<

Page 2
>>showpage, press <return> to continue<<

Page 3
GPL Ghostscript 9.23: Annotation set to non-printing,
 not permitted in PDF/A, reverting to normal PDF output
>>showpage, press <return> to continue<<


So using version 9.23 results in a PDF file which is not a PDF/A-1b file, but does include the hyperlink annnotation. You can use the PDFACompatibilityPolicy to instead behave like earlier versions of Ghostscript which silently dropped the offending annotation and produce a PDF/A-1b file.

In short; hyperlinks are annotations which do not print. Non-printing annotations are not permitted in PDF/A-1b, therefore it is not possible to produce a PDF/A-1b file which preserves the hyperlink. Therefore this bug report is invalid.


There are several other problems with your command line:

You should not use -dNOOUTERSAVE

You should not use -dUseCIEColor with pdfwrite (and recent version of GS will tell you this)

You have set ProcessColorModel, but you have not set ColorConversionStratgey. You should not set ProcessColorModel, and you *MUST* set ColorConversionStrategy when producing a PDF/A file.

You can't set CompatibilityLevel when producing PDF/A-1, as that has a specific requirement for the version of PDF it produces.

-dPDFSETTINGS=/default is, clearly, pointless since the defaults will be used if you don't set it!

Setting PDFSETTINGS *after* -dSubsetFonts=false and -dEmbedAllFotns resets those values to the defaults. You either need to set those *after* PDFSETTINGS or simply not set -dPDFSETTINGS.

-dAlignToPixel and -dGridFitTT have absolutely no effect on pdfwrite.

You should generally not set -r, unless you have a good and specific reason. In general it has no effect on the output of pdfwrite since, in general, pdfwrite doesn't render its output, it preserves it as vector.


Finally you should, clearly, be using the current release, not 9.06 which is 5 years old.

Oh, and you should check that your usage of Ghostscript is permitted under the AGPL version 3 (which covers software-as-a-service), the licence under which Ghostscript is made available.
Comment 3 Rajiv 2018-08-08 09:44:23 UTC
Thanks Ken for sharing this information !

Regards,
Rajiv