Bug 708066 - Attachments missing in PDF but according to file size their data is embedded
Summary: Attachments missing in PDF but according to file size their data is embedded
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 10.04.0
Hardware: PC Windows 10
: P2 normal
Assignee: Default assignee
URL:
Keywords:
: 708065 708179 708190 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-10-02 17:12 UTC by Reinhard Nißl
Modified: 2025-01-16 12:23 UTC (History)
5 users (show)

See Also:
Customer:
Word Size: ---


Attachments
input and output files (70.86 KB, application/x-compressed)
2024-10-02 17:12 UTC, Reinhard Nißl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reinhard Nißl 2024-10-02 17:12:06 UTC
Created attachment 26089 [details]
input and output files

Running the below commands results in output files of similar size, so both contain the attachments data, but for any reason, Adobe Reader doesn't show any attachments for 10.04.0.

Also other software for extracting attachment factur-x.xml cannot find it, so I think, this is not an Adobe Reader issue.

And it works for 10.03.1.

Tried to disable all compression for easier diffing of the files, but didn't succeed.

...\gs10.03.1\bin\gswin64c.exe -I. -q -dNOPAUSE -dBATCH -dNOSAFER -sPAPERSIZE=a4
-dPDFA=3 -sColorConversionStrategy=RGB -sDEVICE=pdfwrite -sOutputFile=output_10.03.1.pdf -r600 -c 30000000 setvmthreshold -dCompressPages=false -dCompressStreams=false -dCompressFonts=false -dUseFlateCompression=false -dWriteXRefStm=false -dWriteObjStms=false -f PDFA_def.ps mailFilterText.ps "-s@@mailinvoice:=invoice.xml" invoice.ps -c .setsafe -f input.ps  %%[ ProductName: GPL Ghostscript ]%%
%%[Page: 1]%%
%%[LastPage]%%

...\gs10.04.0\bin\gswin64c.exe -I. -q -dNOPAUSE -dBATCH -dNOSAFER -sPAPERSIZE=a4 -dPDFA=3 -sColorConversionStrategy=RGB -sDEVICE=pdfwrite -sOutputFile=output_10.04.0.pdf -r600 -c 30000000 setvmthreshold -dCompressPages=false -dCompressStreams=false -dCompressFonts=false -dUseFlateCompression=false -dWriteXRefStm=false -dWriteObjStms=false -f PDFA_def.ps mailFilterText.ps "-s@@mailinvoice:=invoice.xml" invoice.ps -c .setsafe -f input.ps
%%[ ProductName: GPL Ghostscript ]%%
%%[Page: 1]%%
%%[LastPage]%%
Comment 1 Ken Sharp 2024-10-11 08:07:59 UTC
*** Bug 708065 has been marked as a duplicate of this bug. ***
Comment 2 Ken Sharp 2024-10-11 08:29:26 UTC
As noted in the title, the XML (both the embedded file and the metadata for ZuGFERD) is present in the output PDF file.

The reason Acrobat can't find it is twofold; firstly because your PostScript program adds a /AF key to the Catalog dictionary. Since commit 	fc04328faeaa646359783eab980416020682ccaa pdfwrite now emits a /AF key for PDF/A-3 files, as this is a required entry. The result of your program adding one is that the Catalog now gets *2* /AF entries, which is illegal. In addition it seems Acrobat doesn't like an indirect reference which points to nothing more than an indirect reference.

This commit 5d9b000c70f66f5be7bfaed1f16ef4e50d820dc6 prevents the indirection, and will not write the pdfwrite-generated /AF key if one already exists in the Catalog dictionary.

You can update your PostScript program so that it doesn't write a /AF if you wish, or rely on pdfwrite not to add another one.
Comment 3 Ken Sharp 2024-12-06 08:55:48 UTC
*** Bug 708179 has been marked as a duplicate of this bug. ***
Comment 4 Ken Sharp 2024-12-12 10:01:58 UTC
*** Bug 708190 has been marked as a duplicate of this bug. ***
Comment 5 jandmc88+gs 2025-01-16 12:04:25 UTC
Is there any MAC OS compiled version available having this fix ( http://www.ghostscript.com/cgi-bin/findgit.cgi?5d9b000c70f66f5be7bfaed1f16ef4e50d820dc6 ) included? 
Homebrew has 10.04 ...
Comment 6 Hinnack 2025-01-16 12:23:30 UTC
I have the same problem on win32.
I tried myself with no luck and downloaded this example here (for win64 and changed it to win32) with no luck ether.
https://github.com/kerm1t/zugferd

Will you reopen this bug or should I open a new one?

regards
Hinnack