From cb14c16722533ee99b36a2e6efd9a6e4820954a3 Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Fri, 9 Apr 2021 21:01:58 +0000 Subject: Upgrade gs-9.53.3 -> gs-9.54.0 git-svn-id: svn://tug.org/texlive/trunk@58805 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/tlgs/lib/align.ps | 2 +- Master/tlpkg/tlgs/lib/caption.ps | 2 +- Master/tlpkg/tlgs/lib/cid2code.ps | 2 +- Master/tlpkg/tlgs/lib/docie.ps | 2 +- Master/tlpkg/tlgs/lib/gs_ce_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_css_e.ps | 117 ++++++++++++++ Master/tlpkg/tlgs/lib/gs_il2_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_kanji.ps | 2 +- Master/tlpkg/tlgs/lib/gs_ksb_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_lgo_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_lgx_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_wl1_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_wl2_e.ps | 2 +- Master/tlpkg/tlgs/lib/gs_wl5_e.ps | 2 +- Master/tlpkg/tlgs/lib/gslp.ps | 2 +- Master/tlpkg/tlgs/lib/gsnup.ps | 2 +- Master/tlpkg/tlgs/lib/image-qa.ps | 2 +- Master/tlpkg/tlgs/lib/jispaper.ps | 2 +- Master/tlpkg/tlgs/lib/lines.ps | 2 +- Master/tlpkg/tlgs/lib/mkcidfm.ps | 2 +- Master/tlpkg/tlgs/lib/pdf2dsc.ps | 2 +- Master/tlpkg/tlgs/lib/pdf_info.ps | 155 +++++++++++++++---- Master/tlpkg/tlgs/lib/pfbtopfa.ps | 2 +- Master/tlpkg/tlgs/lib/ppath.ps | 2 +- Master/tlpkg/tlgs/lib/pphs.ps | 2 +- Master/tlpkg/tlgs/lib/prfont.ps | 2 +- Master/tlpkg/tlgs/lib/ps2ai.ps | 2 +- Master/tlpkg/tlgs/lib/ps2epsi.ps | 2 +- Master/tlpkg/tlgs/lib/rollconv.ps | 2 +- Master/tlpkg/tlgs/lib/stocht.ps | 2 +- Master/tlpkg/tlgs/lib/traceimg.ps | 2 +- Master/tlpkg/tlgs/lib/traceop.ps | 2 +- Master/tlpkg/tlgs/lib/uninfo.ps | 2 +- Master/tlpkg/tlgs/lib/viewcmyk.ps | 2 +- Master/tlpkg/tlgs/lib/viewgif.ps | 2 +- Master/tlpkg/tlgs/lib/viewmiff.ps | 2 +- Master/tlpkg/tlgs/lib/viewpbm.ps | 2 +- Master/tlpkg/tlgs/lib/viewpcx.ps | 2 +- Master/tlpkg/tlgs/lib/viewps2a.ps | 2 +- Master/tlpkg/tlgs/lib/viewpwg.ps | 2 +- Master/tlpkg/tlgs/lib/viewraw.ps | 2 +- Master/tlpkg/tlgs/lib/viewrgb.ps | 2 +- Master/tlpkg/tlgs/lib/winmaps.ps | 2 +- Master/tlpkg/tlgs/lib/zeroline.ps | 2 +- Master/tlpkg/tlgs/lib/zugferd.ps | 316 ++++++++++++++++++++++++++++++++++++++ 45 files changed, 604 insertions(+), 68 deletions(-) create mode 100644 Master/tlpkg/tlgs/lib/gs_css_e.ps create mode 100644 Master/tlpkg/tlgs/lib/zugferd.ps (limited to 'Master/tlpkg/tlgs/lib') diff --git a/Master/tlpkg/tlgs/lib/align.ps b/Master/tlpkg/tlgs/lib/align.ps index 8f2ebf5a94f..e1f562b39a1 100644 --- a/Master/tlpkg/tlgs/lib/align.ps +++ b/Master/tlpkg/tlgs/lib/align.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/caption.ps b/Master/tlpkg/tlgs/lib/caption.ps index 1ec719a74c9..7e345ba502e 100644 --- a/Master/tlpkg/tlgs/lib/caption.ps +++ b/Master/tlpkg/tlgs/lib/caption.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/cid2code.ps b/Master/tlpkg/tlgs/lib/cid2code.ps index 98423fb7fd2..45044cdf955 100644 --- a/Master/tlpkg/tlgs/lib/cid2code.ps +++ b/Master/tlpkg/tlgs/lib/cid2code.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/docie.ps b/Master/tlpkg/tlgs/lib/docie.ps index 82a16bb0afe..1d1ad9a193c 100644 --- a/Master/tlpkg/tlgs/lib/docie.ps +++ b/Master/tlpkg/tlgs/lib/docie.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_ce_e.ps b/Master/tlpkg/tlgs/lib/gs_ce_e.ps index 5db08a11ab5..150c55b27a3 100644 --- a/Master/tlpkg/tlgs/lib/gs_ce_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_ce_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_css_e.ps b/Master/tlpkg/tlgs/lib/gs_css_e.ps new file mode 100644 index 00000000000..c4323bc5b06 --- /dev/null +++ b/Master/tlpkg/tlgs/lib/gs_css_e.ps @@ -0,0 +1,117 @@ +% Copyright (C) 2001-2021 Artifex Software, Inc. +% All Rights Reserved. +% +% This software is provided AS-IS with no warranty, either express or +% implied. +% +% This software is distributed under license and may not be copied, +% modified or distributed except as expressly authorized under the terms +% of the license contained in the file LICENSE in this distribution. +% +% Refer to licensing information at http://www.artifex.com or contact +% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, +% CA 94903, U.S.A., +1(415)492-9861, for further information. +% + +% Define the CFF StandardStrings that represent characters. +% This is a pseudo-encoding. +/currentglobal where + { pop currentglobal { setglobal } //true setglobal } + { { } } +ifelse +/CFFStandardStrings mark + +% 0 + /.notdef /space /exclam /quotedbl /numbersign + /dollar /percent /ampersand /quoteright /parenleft + /parenright /asterisk /plus /comma /hyphen + /period /slash /zero /one /two + /three /four /five /six /seven + /eight /nine /colon /semicolon /less + /equal /greater /question /at /A + /B /C /D /E /F + /G /H /I /J /K + /L /M /N /O /P +% 50 + /Q /R /S /T /U + /V /W /X /Y /Z + /bracketleft /backslash /bracketright /asciicircum /underscore + /quoteleft /a /b /c /d + /e /f /g /h /i + /j /k /l /m /n + /o /p /q /r /s + /t /u /v /w /x + /y /z /braceleft /bar /braceright + /asciitilde /exclamdown /cent /sterling /fraction +% 100 + /yen /florin /section /currency /quotesingle + /quotedblleft /guillemotleft /guilsinglleft /guilsinglright /fi + /fl /endash /dagger /daggerdbl /periodcentered + /paragraph /bullet /quotesinglbase /quotedblbase /quotedblright + /guillemotright /ellipsis /perthousand /questiondown /grave + /acute /circumflex /tilde /macron /breve + /dotaccent /dieresis /ring /cedilla /hungarumlaut + /ogonek /caron /emdash /AE /ordfeminine + /Lslash /Oslash /OE /ordmasculine /ae + /dotlessi /lslash /oslash /oe /germandbls +% 150 + /onesuperior /logicalnot /mu /trademark /Eth + /onehalf /plusminus /Thorn /onequarter /divide + /brokenbar /degree /thorn /threequarters /twosuperior + /registered /minus /eth /multiply /threesuperior + /copyright /Aacute /Acircumflex /Adieresis /Agrave + /Aring /Atilde /Ccedilla /Eacute /Ecircumflex + /Edieresis /Egrave /Iacute /Icircumflex /Idieresis + /Igrave /Ntilde /Oacute /Ocircumflex /Odieresis + /Ograve /Otilde /Scaron /Uacute /Ucircumflex + /Udieresis /Ugrave /Yacute /Ydieresis /Zcaron +% 200 + /aacute /acircumflex /adieresis /agrave /aring + /atilde /ccedilla /eacute /ecircumflex /edieresis + /egrave /iacute /icircumflex /idieresis /igrave + /ntilde /oacute /ocircumflex /odieresis /ograve + /otilde /scaron /uacute /ucircumflex /udieresis + /ugrave /yacute /ydieresis /zcaron /exclamsmall + /Hungarumlautsmall /dollaroldstyle /dollarsuperior /ampersandsmall /Acutesmall + /parenleftsuperior /parenrightsuperior /twodotenleader /onedotenleader /zerooldstyle + /oneoldstyle /twooldstyle /threeoldstyle /fouroldstyle /fiveoldstyle + /sixoldstyle /sevenoldstyle /eightoldstyle /nineoldstyle /commasuperior +% 250 + /threequartersemdash /periodsuperior /questionsmall /asuperior /bsuperior + /centsuperior /dsuperior /esuperior /isuperior /lsuperior + /msuperior /nsuperior /osuperior /rsuperior /ssuperior + /tsuperior /ff /ffi /ffl /parenleftinferior + /parenrightinferior /Circumflexsmall /hyphensuperior /Gravesmall /Asmall + /Bsmall /Csmall /Dsmall /Esmall /Fsmall + /Gsmall /Hsmall /Ismall /Jsmall /Ksmall + /Lsmall /Msmall /Nsmall /Osmall /Psmall + /Qsmall /Rsmall /Ssmall /Tsmall /Usmall + /Vsmall /Wsmall /Xsmall /Ysmall /Zsmall +% 300 + /colonmonetary /onefitted /rupiah /Tildesmall /exclamdownsmall + /centoldstyle /Lslashsmall /Scaronsmall /Zcaronsmall /Dieresissmall + /Brevesmall /Caronsmall /Dotaccentsmall /Macronsmall /figuredash + /hypheninferior /Ogoneksmall /Ringsmall /Cedillasmall /questiondownsmall + /oneeighth /threeeighths /fiveeighths /seveneighths /onethird + /twothirds /zerosuperior /foursuperior /fivesuperior /sixsuperior + /sevensuperior /eightsuperior /ninesuperior /zeroinferior /oneinferior + /twoinferior /threeinferior /fourinferior /fiveinferior /sixinferior + /seveninferior /eightinferior /nineinferior /centinferior /dollarinferior + /periodinferior /commainferior /Agravesmall /Aacutesmall /Acircumflexsmall +% 350 + /Atildesmall /Adieresissmall /Aringsmall /AEsmall /Ccedillasmall + /Egravesmall /Eacutesmall /Ecircumflexsmall /Edieresissmall /Igravesmall + /Iacutesmall /Icircumflexsmall /Idieresissmall /Ethsmall /Ntildesmall + /Ogravesmall /Oacutesmall /Ocircumflexsmall /Otildesmall /Odieresissmall + /OEsmall /Oslashsmall /Ugravesmall /Uacutesmall /Ucircumflexsmall + /Udieresissmall /Yacutesmall /Thornsmall /Ydieresissmall +% 379 + /001.000 /001.001 /001.002 /001.003 + /Black /Bold /Book /Light /Medium + /Regular /Roman /Semibold +%391 = end + +counttomark packedarray exch pop +10 1 index .registerencoding +.defineencoding +exec diff --git a/Master/tlpkg/tlgs/lib/gs_il2_e.ps b/Master/tlpkg/tlgs/lib/gs_il2_e.ps index 7ef56d4595f..e9ee3075845 100644 --- a/Master/tlpkg/tlgs/lib/gs_il2_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_il2_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_kanji.ps b/Master/tlpkg/tlgs/lib/gs_kanji.ps index 862f5ff333e..f2de7816242 100644 --- a/Master/tlpkg/tlgs/lib/gs_kanji.ps +++ b/Master/tlpkg/tlgs/lib/gs_kanji.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_ksb_e.ps b/Master/tlpkg/tlgs/lib/gs_ksb_e.ps index 4d228765c5f..2d2960c74bc 100644 --- a/Master/tlpkg/tlgs/lib/gs_ksb_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_ksb_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_lgo_e.ps b/Master/tlpkg/tlgs/lib/gs_lgo_e.ps index dd04ff6673f..1f949ab9b54 100644 --- a/Master/tlpkg/tlgs/lib/gs_lgo_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_lgo_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_lgx_e.ps b/Master/tlpkg/tlgs/lib/gs_lgx_e.ps index 0c12e2d871c..a2f6216077f 100644 --- a/Master/tlpkg/tlgs/lib/gs_lgx_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_lgx_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_wl1_e.ps b/Master/tlpkg/tlgs/lib/gs_wl1_e.ps index 72185fee271..10a8f3ca533 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl1_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl1_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_wl2_e.ps b/Master/tlpkg/tlgs/lib/gs_wl2_e.ps index 6b55c55743c..f7fc8cc1e9a 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl2_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl2_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gs_wl5_e.ps b/Master/tlpkg/tlgs/lib/gs_wl5_e.ps index 4f259792f70..f7549b49d8b 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl5_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl5_e.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gslp.ps b/Master/tlpkg/tlgs/lib/gslp.ps index 9e2c21bf304..173d52c2170 100644 --- a/Master/tlpkg/tlgs/lib/gslp.ps +++ b/Master/tlpkg/tlgs/lib/gslp.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/gsnup.ps b/Master/tlpkg/tlgs/lib/gsnup.ps index ea01d874bb8..61fd57a6633 100644 --- a/Master/tlpkg/tlgs/lib/gsnup.ps +++ b/Master/tlpkg/tlgs/lib/gsnup.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/image-qa.ps b/Master/tlpkg/tlgs/lib/image-qa.ps index 307a951d31b..4780c14e583 100644 --- a/Master/tlpkg/tlgs/lib/image-qa.ps +++ b/Master/tlpkg/tlgs/lib/image-qa.ps @@ -1,5 +1,5 @@ %!PS -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/jispaper.ps b/Master/tlpkg/tlgs/lib/jispaper.ps index d1e33e6acb7..6b59f70b0b5 100644 --- a/Master/tlpkg/tlgs/lib/jispaper.ps +++ b/Master/tlpkg/tlgs/lib/jispaper.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/lines.ps b/Master/tlpkg/tlgs/lib/lines.ps index 287b6bdbea2..a721009aaf6 100644 --- a/Master/tlpkg/tlgs/lib/lines.ps +++ b/Master/tlpkg/tlgs/lib/lines.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/mkcidfm.ps b/Master/tlpkg/tlgs/lib/mkcidfm.ps index 7dd92fe39e3..6e017161dc3 100644 --- a/Master/tlpkg/tlgs/lib/mkcidfm.ps +++ b/Master/tlpkg/tlgs/lib/mkcidfm.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/pdf2dsc.ps b/Master/tlpkg/tlgs/lib/pdf2dsc.ps index 88bc1536242..8e65d9e0279 100644 --- a/Master/tlpkg/tlgs/lib/pdf2dsc.ps +++ b/Master/tlpkg/tlgs/lib/pdf2dsc.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/pdf_info.ps b/Master/tlpkg/tlgs/lib/pdf_info.ps index 0b4654ab073..35951e9a736 100644 --- a/Master/tlpkg/tlgs/lib/pdf_info.ps +++ b/Master/tlpkg/tlgs/lib/pdf_info.ps @@ -1,5 +1,5 @@ %!PS -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or @@ -69,6 +69,81 @@ cleartomark % discard the dict from --where-- % ---- No more executable code on the top level after this line ----- % ---- except 2 lines at the very end ----- +% Write a character to the standard output. +/putchar [ % int -> - + (%stdout) (w) file + /exch cvx /write cvx +] cvx bind def + +% Write U+xxxx to the standard output as UTF-8. +/put-ucode { % int -> - + dup 16#80 ge { + dup 16#800 ge { + dup 16#10000 ge { + dup -18 bitshift 16#f0 or putchar + dup -12 bitshift 16#3f and 16#80 or putchar + } { + dup -12 bitshift 16#e0 or putchar + } ifelse + dup -6 bitshift 16#3f and 16#80 or putchar + } { + dup -6 bitshift 16#C0 or putchar + } ifelse + 16#3f and 16#80 or + } if + putchar +} bind def + +% PDFDocEncoding to U+xxxx decoding table. +/doc-to-ucode [ + 0 1 23 {} for + 16#2d8 16#2c7 16#2c6 16#2d9 16#2dd 16#2db 16#2da 16#2dc + 32 1 127 {} for + 16#2022 16#2020 16#2021 16#2026 16#2014 16#2013 16#192 + 16#2044 16#2039 16#203a 16#2212 16#2030 16#201e 16#201c + 16#201d 16#2018 16#2019 16#201a 16#2122 16#fb01 16#fb02 + 16#141 16#152 16#160 16#178 16#17d 16#131 16#142 16#153 + 16#161 16#17e 0 16#20ac + 161 1 255 {} for +] readonly def + +% Convert a doc string from PDFDocEncoding or UTF-16BE to UTF-8 +% and write it to standard output. +/write-doc-string { % (string) -> - + 1024 string cvs anchorsearch { + pop + 0 exch % hi16 (str) + 0 2 2 index length 2 sub { + 2 copy 2 copy % hi16 (str) i (str) i (str) i + get 256 mul 3 1 roll % hi16 (str) i hi*256 (str) i + 1 add get add % hi16 (str) i 256*hi+lo + dup 16#fc00 and dup % hi16 (str) i 256*hi+lo tag tag + 16#d800 eq { % High surrogate + pop + 16#3ff and + 10 bitshift + 16#10000 add % hi16 (str) i hi16' + 4 1 roll % hi16' hi16 (str) i + pop exch pop % hi16' (str) + } { + 16#dc00 eq { % Low surrogate + 16#3ff and % hi16 (str) i (256*hi+lo)&0x3ff + 4 -1 roll add % (str) i (256*hi+lo)&0x3ff+hi16 + put-ucode % (str) i + pop 0 exch % 0 (str) + } { % BMP plane + put-ucode % hi16 (str) i + pop % hi16 (str) + } ifelse + } ifelse + } for + pop pop % - + } { + { //doc-to-ucode exch get put-ucode + } forall + } ifelse +} bind def + %% When checking Resources for Font objects, we must ensure that we don't end %% up following a circular reference. Circular references in Resources should %% not, of course, be present but we've seen a number of cases. If we do detect @@ -92,19 +167,6 @@ cleartomark % discard the dict from --where-- } ifelse } bind def -/printXML { % printXML - - % print non-blank lines without trailing spaces - dup dup length 1 sub -1 0 { - 1 index 1 index get 32 eq { - 0 exch getinterval exch - } { - exch = exit % non-blank on this line - } - ifelse - } for - pop pop % clean up -} bind def - /dump-pdf-info { % (fname) -> - () = ( ) print print ( has ) print PDFPageCount dup =print 10 mod 1 eq { ( page.\n) } { ( pages\n) } ifelse = flush @@ -120,24 +182,24 @@ cleartomark % discard the dict from --where-- pop Trailer /Root oget /Metadata knownoget { //false resolvestream - { dup 256 string readline exch printXML not { exit } if } loop + { dup 256 string readstring exch print not { exit } if } loop pop % done with the stream - (_____________________________________________________________) = + (\n_____________________________________________________________) = flush } if } if % Print out the "Info" dictionary if present Trailer /Info knownoget { - dup /Title knownoget { (Title: ) print = flush } if - dup /Author knownoget { (Author: ) print = flush } if - dup /Subject knownoget { (Subject: ) print = flush } if - dup /Keywords knownoget { (Keywords: ) print = flush } if - dup /Creator knownoget { (Creator: ) print = flush } if - dup /Producer knownoget { (Producer: ) print = flush } if - dup /CreationDate knownoget { (CreationDate: ) print = flush } if - dup /ModDate knownoget { (ModDate: ) print = flush } if - dup /Trapped knownoget { (Trapped: ) print = flush } if + dup /Title knownoget { (Title: ) print write-doc-string () = flush } if + dup /Author knownoget { (Author: ) print write-doc-string () = flush } if + dup /Subject knownoget { (Subject: ) print write-doc-string () = flush } if + dup /Keywords knownoget { (Keywords: ) print write-doc-string () = flush } if + dup /Creator knownoget { (Creator: ) print write-doc-string () = flush } if + dup /Producer knownoget { (Producer: ) print write-doc-string () = flush } if + dup /CreationDate knownoget { (CreationDate: ) print write-doc-string () = flush } if + dup /ModDate knownoget { (ModDate: ) print write-doc-string () = flush } if + dup /Trapped knownoget { (Trapped: ) print write-doc-string () = flush } if pop } if @@ -174,9 +236,27 @@ cleartomark % discard the dict from --where-- pop ( Page contains Annotations) print } if - pageusestransparency { + dup pageusestransparency { ( Page uses transparency features) print } if + dup pagespotcolors + dup length 0 gt { + (\n Page Spot colors: ) = + << /Black 0 /Cyan 0 /Magenta 0 /Yellow 0 >> exch + { + pop % discard the value + 1 index 1 index known not { % check if colorant is a standard one + ( ) print + (') print =print (') = + } { + pop % ignore this standard colorant + } ifelse + } forall + pop % discard dict of standard colorants + } { + pop + } ifelse + pop % done with pagedict () = flush } { @@ -193,6 +273,7 @@ cleartomark % discard the dict from --where-- ] def /res-type-dict 10 dict begin + /Font { { exch pop oforce_no_circular @@ -318,6 +399,28 @@ currentdict /res-type-dict undef currentdict /ProcessedResources undef } bind def +% If running with -dSAFER, .sort may not be present. Define a (slower) PS alternative +systemdict /.sort known not { +% .sort + /.sort + { 1 index length 1 sub -1 1 + { 2 index exch 2 copy get 3 copy % arr proc arr i arr[i] arr i arr[i] + 0 1 3 index 1 sub + { 3 index 1 index get % arr proc arr i arr[i] arr imax amax j arr[j] + 2 index 1 index 10 index exec + { % ... amax < arr[j] + 4 2 roll + } + if pop pop + } + for % arr proc arr i arr[i] arr imax amax + 4 -1 roll exch 4 1 roll put put + } + for + pop + } bind def +} if + /dump-fonts-used { % dump-fonts-used - % If DumpFontsUsed is not true, then remove the 'standard' fonts from the list systemdict /DumpFontsUsed known not { diff --git a/Master/tlpkg/tlgs/lib/pfbtopfa.ps b/Master/tlpkg/tlgs/lib/pfbtopfa.ps index 2b69c58f63a..e31db5b0603 100644 --- a/Master/tlpkg/tlgs/lib/pfbtopfa.ps +++ b/Master/tlpkg/tlgs/lib/pfbtopfa.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/ppath.ps b/Master/tlpkg/tlgs/lib/ppath.ps index 5c571019d05..daf7f3990e2 100644 --- a/Master/tlpkg/tlgs/lib/ppath.ps +++ b/Master/tlpkg/tlgs/lib/ppath.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/pphs.ps b/Master/tlpkg/tlgs/lib/pphs.ps index 8605f2dd367..78dfd060e23 100644 --- a/Master/tlpkg/tlgs/lib/pphs.ps +++ b/Master/tlpkg/tlgs/lib/pphs.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/prfont.ps b/Master/tlpkg/tlgs/lib/prfont.ps index 059d2a08483..59b9c199610 100644 --- a/Master/tlpkg/tlgs/lib/prfont.ps +++ b/Master/tlpkg/tlgs/lib/prfont.ps @@ -1,7 +1,7 @@ %! %%Creator: Eric Gisin %%Title: Print font catalog -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/ps2ai.ps b/Master/tlpkg/tlgs/lib/ps2ai.ps index 20ae204eb04..fd0dac4a863 100644 --- a/Master/tlpkg/tlgs/lib/ps2ai.ps +++ b/Master/tlpkg/tlgs/lib/ps2ai.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/ps2epsi.ps b/Master/tlpkg/tlgs/lib/ps2epsi.ps index 54621f92834..07d19ded1ee 100644 --- a/Master/tlpkg/tlgs/lib/ps2epsi.ps +++ b/Master/tlpkg/tlgs/lib/ps2epsi.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/rollconv.ps b/Master/tlpkg/tlgs/lib/rollconv.ps index 3a39e02122a..edeb11074e8 100644 --- a/Master/tlpkg/tlgs/lib/rollconv.ps +++ b/Master/tlpkg/tlgs/lib/rollconv.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/stocht.ps b/Master/tlpkg/tlgs/lib/stocht.ps index 8c9bb438303..bf0c5905a11 100644 --- a/Master/tlpkg/tlgs/lib/stocht.ps +++ b/Master/tlpkg/tlgs/lib/stocht.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/traceimg.ps b/Master/tlpkg/tlgs/lib/traceimg.ps index 4ab8720f4b7..eb5cba8cfb2 100644 --- a/Master/tlpkg/tlgs/lib/traceimg.ps +++ b/Master/tlpkg/tlgs/lib/traceimg.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/traceop.ps b/Master/tlpkg/tlgs/lib/traceop.ps index ecd8ce271df..7fa5bcb4df4 100644 --- a/Master/tlpkg/tlgs/lib/traceop.ps +++ b/Master/tlpkg/tlgs/lib/traceop.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/uninfo.ps b/Master/tlpkg/tlgs/lib/uninfo.ps index 98e89062fd6..a2cff7ed7ef 100644 --- a/Master/tlpkg/tlgs/lib/uninfo.ps +++ b/Master/tlpkg/tlgs/lib/uninfo.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewcmyk.ps b/Master/tlpkg/tlgs/lib/viewcmyk.ps index e4250bf1d21..e8034e53346 100644 --- a/Master/tlpkg/tlgs/lib/viewcmyk.ps +++ b/Master/tlpkg/tlgs/lib/viewcmyk.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewgif.ps b/Master/tlpkg/tlgs/lib/viewgif.ps index 55a39862b2c..a261bf7e654 100644 --- a/Master/tlpkg/tlgs/lib/viewgif.ps +++ b/Master/tlpkg/tlgs/lib/viewgif.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewmiff.ps b/Master/tlpkg/tlgs/lib/viewmiff.ps index 39d715d04c2..90db80b0922 100644 --- a/Master/tlpkg/tlgs/lib/viewmiff.ps +++ b/Master/tlpkg/tlgs/lib/viewmiff.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewpbm.ps b/Master/tlpkg/tlgs/lib/viewpbm.ps index ec355313767..c8d3f86bc84 100644 --- a/Master/tlpkg/tlgs/lib/viewpbm.ps +++ b/Master/tlpkg/tlgs/lib/viewpbm.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewpcx.ps b/Master/tlpkg/tlgs/lib/viewpcx.ps index 6840f1e5c0f..76bfdfae6eb 100644 --- a/Master/tlpkg/tlgs/lib/viewpcx.ps +++ b/Master/tlpkg/tlgs/lib/viewpcx.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewps2a.ps b/Master/tlpkg/tlgs/lib/viewps2a.ps index e0fb32bdab6..dafb6d5c3b0 100644 --- a/Master/tlpkg/tlgs/lib/viewps2a.ps +++ b/Master/tlpkg/tlgs/lib/viewps2a.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewpwg.ps b/Master/tlpkg/tlgs/lib/viewpwg.ps index 9abae63a436..4ee0cdb7aed 100644 --- a/Master/tlpkg/tlgs/lib/viewpwg.ps +++ b/Master/tlpkg/tlgs/lib/viewpwg.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2017-2018 Artifex Software, Inc. +% Copyright (C) 2017-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewraw.ps b/Master/tlpkg/tlgs/lib/viewraw.ps index f1a3f890147..dee86e02300 100644 --- a/Master/tlpkg/tlgs/lib/viewraw.ps +++ b/Master/tlpkg/tlgs/lib/viewraw.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/viewrgb.ps b/Master/tlpkg/tlgs/lib/viewrgb.ps index adde24e4c5d..ab2f6d82c4a 100644 --- a/Master/tlpkg/tlgs/lib/viewrgb.ps +++ b/Master/tlpkg/tlgs/lib/viewrgb.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/winmaps.ps b/Master/tlpkg/tlgs/lib/winmaps.ps index 75933fc2e9d..9a4499ac3ee 100644 --- a/Master/tlpkg/tlgs/lib/winmaps.ps +++ b/Master/tlpkg/tlgs/lib/winmaps.ps @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/zeroline.ps b/Master/tlpkg/tlgs/lib/zeroline.ps index 7ace3ca323b..37f9fda416a 100644 --- a/Master/tlpkg/tlgs/lib/zeroline.ps +++ b/Master/tlpkg/tlgs/lib/zeroline.ps @@ -1,5 +1,5 @@ %! -% Copyright (C) 2001-2020 Artifex Software, Inc. +% Copyright (C) 2001-2021 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or diff --git a/Master/tlpkg/tlgs/lib/zugferd.ps b/Master/tlpkg/tlgs/lib/zugferd.ps new file mode 100644 index 00000000000..0320fb69e8e --- /dev/null +++ b/Master/tlpkg/tlgs/lib/zugferd.ps @@ -0,0 +1,316 @@ +% Copyright (C) 2001-2021 Artifex Software, Inc. +% All Rights Reserved. +% +% This software is provided AS-IS with no warranty, either express or +% implied. +% +% This software is distributed under license and may not be copied, +% modified or distributed except as expressly authorized under the terms +% of the license contained in the file LICENSE in this distribution. +% +% Refer to licensing information at http://www.artifex.com or contact +% Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, +% CA 94945, U.S.A., +1(415)492-9861, for further information. +% +% zugferd.ps +% This program will create an (unsigned) ZUGFeRD compliant PDF file. In +% order to do so the user must provide certain information, or edit this program. +% +% Required information is the path to the XML file containing the invoice data, +% and the path to an ICC profile appropriate for the chosen ColorConversionStrategy. +% -sZUGFeRDXMLFile defines a path to the XML invoice file and -sZUGFeRDProfile +% defines the path to the ICC profile. +% +% The user must additionally set -dPDFA=3 and -sColorConversionStrategy on the +% Ghostscript command line, and set the permissions for Ghostscript to read +% both these files. It is simplest to put the files in a directory and then +% permit reading of the entire directory. +% +% Example command line : +% +% gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3 -sColorConversionStrategy=RGB \ +% -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml -sZUGFeRDProfile=/usr/home/me/rgb.icc \ +% -o /usr/home/me/zugferd/zugferd.pdf /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf +% +% Much of this program results from a Ghostscript bug report, the thread can be found at +% https://bugs.ghostscript.com/show_bug.cgi?id=696472 Portions of the code below were +% supplied by Reinhard Nissl and I'm indebted to him for his efforts in helping me create +% a solution for this problem as well as for the code he supplied, particularly for the +% SimpleUTF16BE routine. +% +% It should not be necessary to modify this program, the comments in the code are there purely for information, +% but there are two areas which might reasonably be altered. The section with the --8<-- lines could be replaced +% with a simpler /N 3 or /N 4 if you always intend to produce the same kind of files; RGB or CMYK. +% In step 7, the large XML string will need to be replaced if you want to produce a ZUGFeRD 2.1 +% file, and in future may require similar modification for later versions. +% + +% istring SimpleUTF16BE ostring +/SimpleUTF16BE +{ + dup length + 1 add + 2 mul + string + + % istring ostring + dup 0 16#FE put + dup 1 16#FF put + 2 + 3 -1 roll + + % ostring index istring + { + % ostring index ichar + 3 1 roll + % ichar ostring index + 2 copy 16#00 put + 1 add + 2 copy + 5 -1 roll + % ostring index ostring index ichar + put + 1 add + % ostring index + } + forall + + % ostring index + pop +} +bind def + +% First check that the user has defined the XML invoice file on the command line +% +/ZUGFeRDXMLFile where { + pop % Discard the dictionary + % + % Now check that the ICC Profile is defined + % + /ZUGFeRDProfile where { + pop % Discard the dictionary + + % Step 1, add the required PDF/A boilerplate. This is mostly copied from lib/pdfa_de.ps + % Create a PDF stream object to hold the ICC profile. + [ /_objdef {icc_PDFA} /type /stream /OBJ pdfmark + + % Add the required entries to the stream dictionary (/N only) + [ {icc_PDFA} + << + %% This code attempts to set the /N (number of components) key for the ICC colour space. + %% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if + %% ColorConversionStrategy is not set. + %% This is not 100% reliable. A better solution is for the user to edit this and replace + %% the code between the ---8<--- lines with a simple declaration like: + %% /N 3 + %% where the value of N is the number of components from the profile defined in ZUGFeRDProfile. + %% + %% ----------8<--------------8<-------------8<--------------8<---------- + systemdict /ColorConversionStrategy known { + systemdict /ColorConversionStrategy get cvn dup /Gray eq { + pop /N 1 false + }{ + dup /RGB eq { + pop /N 3 false + }{ + /CMYK eq { + /N 4 false + }{ + (ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.)= + true + } ifelse + } ifelse + } ifelse + } { + (ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.)= + true + } ifelse + + { + currentpagedevice /ProcessColorModel get + dup /DeviceGray eq { + pop /N 1 + }{ + dup /DeviceRGB eq { + pop /N 3 + }{ + dup /DeviceCMYK eq { + pop /N 4 + } { + (ProcessColorModel not a device space.)= + /ProcessColorModel cvx /rangecheck signalerror + } ifelse + } ifelse + } ifelse + } if + %% ----------8<--------------8<-------------8<--------------8<---------- + >> /PUT pdfmark + + % Now read the ICC profile from the file into the stream + [ {icc_PDFA} ZUGFeRDProfile (r) file /PUT pdfmark + + % Define the output intent dictionary : + [/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark + + % Add the required keys to the dictionary + [{OutputIntent_PDFA} << + /Type /OutputIntent + /S /GTS_PDFA1 % Required for PDF/A. + /DestOutputProfile {icc_PDFA} % The actual profile. + /OutputConditionIdentifier (Custom) % A better solution is a string from the ICC Registry, but Custom is always valid. + >> /PUT pdfmark + + % And now add the OutputIntent to the Catalog dictionary + [ {Catalog} << /OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark + + + % Step 2, define the XML file and read it into the PDF + % First we define the PDF stream to contain the XML invoice + [ /_objdef {InvoiceStream} /type /stream /OBJ pdfmark + + % Fill in the dictionary elements we need. We believe the + % ModDate is not useful so it's just set to a valid value. + [ {InvoiceStream} << + /Type /EmbeddedFile + /Subtype (text/xml) cvn + /Params << + /ModDate (D:20130121081433+01’00’) + >> + >> /PUT pdfmark + + % Now read the data from the file and store it in the stream + [ {InvoiceStream} ZUGFeRDXMLFile (r) file /PUT pdfmark + + % and close the stream + [ {InvoiceStream} /CLOSE pdfmark + + + % Step 3 create the File Specification dictionary for the embedded file + % Create the dictionary + [ /_objdef {FSDict} /type /dict /OBJ pdfmark + + % Fill in the required dictionary elements + [ {FSDict} << + /Type /FileSpec + /F ZUGFeRDXMLFile + /UF ZUGFeRDXMLFile SimpleUTF16BE + /Desc (ZUGFeRD electronic invoice) + /AFRelationship /Alternative + /EF << + /F {InvoiceStream} + /UF {InvoiceStream} + >> + >> + /PUT pdfmark + + + % Step 4 Create the Associated Files dictionary to hold the FS dict + % Create the dictionary + [ /_objdef {AFArray} /type /array /OBJ pdfmark + + % Put (append) the FS dictionary into the Associated Files array + [ {AFArray} {FSDict} /APPEND pdfmark + + + % Step 5 Add an entry in the Catalog dictionary containing the AF array + [ {Catalog} << /AF {AFArray} >> /PUT pdfmark + + + % Step 6 use the EMBED pdfmark to add the XML file and FS dictionary to the PDF name tree + [ /Name ZUGFeRDXMLFile /FS {FSDict} /EMBED pdfmark + + + % Step 7 Add the extra ZUGFeRD XML data to the Metadata + [ /XML +( + + + + + + + + + ZUGFeRD PDFA Extension Schema + + urn:ferd:pdfa:invoice:rc# + + zf + + + + ! + + + DocumentFileName + Text + external + name of the embedded xml invoice file + + + + DocumentType + Text + external + INVOICE + + + + Version + Text + external + The actual version of the ZUGFeRD data + + + + ConformanceLevel + Text + external + The conformance level of the ZUGFeRD data + + + + + + + + + + INVOICE + ZUGFeRD-invoice.xml + RC + BASIC + +) /Ext_Metadata pdfmark + } + { + % No ICC Profile definition on the command line; chide the user and give them an example + % + (\nERROR - ZUGFeRDProfile has not been supplied, you must supply an ICC profile\n) print + ( Producing a potentially invalid PDF/A file!!\n) print + (example usage - gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3\\\n) print + ( -sColorConversionStrategy=RGB -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml\\\n) print + ( -sZUGFeRDProfile=/usr/home/me/rgb.icc -o /usr/home/me/zugferd/zugferd.pdf\\\n) print + ( /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf\n\n) print flush + } ifelse +} +{ + % No XML invoice definition on the command line; chide the user and give them an example + % + (\nERROR - ZUGFeRDXMLFile has not been supplied, you must supply an XML invoice file\n) print + ( Producing a PDF/A file not a ZUGFeRD file.\n) print + (example usage - gs --permit-file-read=/usr/home/me/zugferd/ -sDEVICE=pdfwrite -dPDFA=3\\\n) print + ( -sColorConversionStrategy=RGB -sZUGFeRDXMLFile=/usr/home/me/zugferd/invoice.xml\\\n) print + ( -sZUGFeRDProfile=/usr/home/me/rgb.icc -o /usr/home/me/zugferd/zugferd.pdf\\\n) print + ( /usr/home/me/zugferd/zugferd.ps /usr/home/me/zugferd/original.pdf\n\n) print flush +} ifelse + +% That's all the ZUGFeRD and PDF/A-3 setup completed, all that remains now is to run the input file -- cgit v1.2.3