diff options
Diffstat (limited to 'macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx')
-rw-r--r-- | macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx | 102 |
1 files changed, 96 insertions, 6 deletions
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx index 77b69fad2d..778141f7ae 100644 --- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx +++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx @@ -50,7 +50,7 @@ % }^^A % } % -% \date{Version 0.95n, released 2022-04-14} +% \date{Version 0.95o, released 2022-05-11} % % \maketitle % \begin{documentation} @@ -222,17 +222,45 @@ % tested from TeX, but in a current LaTeX normally ToUnicode are set for all fonts. % \item[|tagged|] that is set in A-2a and A-3a and means that the pdf must be % tagged. This is currently neither tested not enforced somewhere. +% \item[|Trailer_no_Info|] The \texttt{Info} dictionary +% has been deprecated since quite some time. Metadata should be set with +% XMP-data instead. In PDF A-4 now the \texttt{Info} dictionary +% shall not be present in the trailer dictionary at all +% (unless there exists a PieceInfo entry in the Catalog). And if it is present +% it should only contain the \texttt{/ModDate} entry. The engines +% do not offer currently an option to suppress the dictionary completly, +% one can only give the entries the value null (it only works for all entries +% with lualatex and pdflatex). The next pdflatex will offer \cs{pdfomitinfodict}. +% Until then l3pdfmeta does nothing with this requirement. +% % \end{description} % % \subsubsection{Tests with values and special handlers} % % \begin{description} % -% \item[|min_pdf_version|] stores the minimal PDF version. +% \item[|min_pdf_version|] stores the minimal PDF version needed for +% a standard. +% It should be checked against the current PDF version (\cs{pdf_version:}). +% A failure means that the version should be changed. +% Currently there is only one hard requirement which leads to a failure in +% a validator like verapdf: The A-4 standard should use PDF 2.0. +% As PDF A-1 is based on PDF 1.4 and PDF A-2 and A-3 are based +% on PDF 1.7 \pkg{l3pdfmeta} also sets these versions also as requirements. +% These requirements are checked by \pkg{l3pdfmeta} when the version is set with +% \cs{DocumentMetadata} and a warning is issued (but the version is +% not changed). More checks are only needed if the version is changed later. +% +% +% \item[|max_pdf_version|] stores the maximal PDF version. % It should be checked against the current PDF version (\cs{pdf_version:}). % A failure means that the version should be changed. -% This check is done by \pkg{l3pdfmeta} when the version is set with -% \cs{DocumentMetadata} so more checks are only needed if the version is changed later. +% The check is currently relevant only for the A-1 to A-3 standards: +% PDF 2.0 leads to a failure in a validator like verapdf so the maximal +% version should be PDF 1.7. +% This requirement is checked by \pkg{l3pdfmeta} when the version is set with +% \cs{DocumentMetadata} and a warning is issued (but the version is +% not changed). More checks are only needed if the version is changed later. % % \item[|named_actions|] this requirement restricts the list of % allowed named actions to |NextPage|, |PrevPage|, |FirstPage|, |LastPage|. @@ -353,7 +381,7 @@ % \begin{macrocode} %<@@=pdfmeta> %<*header> -\ProvidesExplPackage{l3pdfmeta}{2022-04-14}{0.95n} +\ProvidesExplPackage{l3pdfmeta}{2022-05-11}{0.95o} {PDF-Standards---LaTeX PDF management testphase bundle} %</header> % \end{macrocode} @@ -362,6 +390,11 @@ %<*package> \msg_new:nnn {pdf }{unknown-standard}{The~standard~'#1'~is~unknown~and~has~been~ignored} % \end{macrocode} +% Message for not fitting pdf version +% \begin{macrocode} +\msg_new:nnn {pdf }{wrong-pdfversion} + {PDF~version~#1~is~too~#2~for~standard~'#3'.} +% \end{macrocode} % \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpb_tl,\l_@@_tmpa_str} % \begin{macrocode} \tl_new:N\l_@@_tmpa_tl @@ -456,6 +489,19 @@ } % \end{macrocode} % \end{macro} +% The next is the counter part and checks that the version is not to high +% \begin{macro}{\@@_standard_verify_handler_max_pdf_version:nn} +% \begin{macrocode} +% +\cs_new_protected:Npn \@@_standard_verify_handler_max_pdf_version:nn #1 #2 + { + \pdf_version_compare:NnTF > + { #2 } + {\prg_return_false:} + {\prg_return_true:} + } +% \end{macrocode} +% \end{macro} % The next checks if the user value is in the list and returns a failure if not. % \begin{macro}{\@@_standard_verify_handler_named_actions:nn} % \begin{macrocode} @@ -515,9 +561,30 @@ { \pdfmeta_standard_verify:nF { annot_flags } { \@@_verify_pdfa_annot_flags: } + \pdfmeta_standard_verify:nnF { min_pdf_version } + { \pdf_version: } + { \msg_warning:nnxxx {pdf}{wrong-pdfversion} + {\pdf_version:}{low} + { + \pdfmeta_standard_item:n{type} + - + \pdfmeta_standard_item:n{level} + } + } + \pdfmeta_standard_verify:nnF { max_pdf_version } + { \pdf_version: } + { \msg_warning:nnxxx {pdf}{wrong-pdfversion} + {\pdf_version:}{high} + { + \pdfmeta_standard_item:n{type} + - + \pdfmeta_standard_item:n{level} + } + } } % \end{macrocode} % +% % \subsubsection{pdf/A} % We use global properties so that follow up standards can be % copied and then adjusted. @@ -531,6 +598,7 @@ % \g_@@_standard_pdf/A-3A_prop , % \g_@@_standard_pdf/A-3B_prop , % \g_@@_standard_pdf/A-3U_prop , +% \g_@@_standard_pdf/A-4_prop , % } % \begin{macrocode} \prop_new:c { g_@@_standard_pdf/A-1B_prop } @@ -542,6 +610,7 @@ ,conformance = B ,year = 2005 ,min_pdf_version = 1.4 %minimum + ,max_pdf_version = 1.4 %minimum ,no_encryption = ,no_external_content = % no F, FFilter, or FDecodeParms in stream dicts ,no_embed_content = % no EF key in filespec, no /Type/EmbeddedFiles @@ -605,7 +674,8 @@ \prop_gremove:cn { g_@@_standard_pdf/A-2B_prop } { embed_content} - +\prop_gput:cnn + { g_@@_standard_pdf/A-2B_prop }{max_pdf_version}{1.7} %A-2u ============== \prop_new:c { g_@@_standard_pdf/A-2U_prop } \prop_gset_eq:cc @@ -669,6 +739,26 @@ { g_@@_standard_pdf/A-3A_prop }{conformance}{A} \prop_gput:cnn { g_@@_standard_pdf/A-3A_prop }{tagged}{} + +%A-4 ============== +\prop_new:c { g_@@_standard_pdf/A-4_prop } +\prop_gset_eq:cc + { g_@@_standard_pdf/A-4_prop } + { g_@@_standard_pdf/A-3U_prop } +\prop_gput:cnn + { g_@@_standard_pdf/A-4_prop }{name}{pdf/A-4} +\prop_gput:cnn + { g_@@_standard_pdf/A-4_prop }{level}{4} +\prop_gput:cnn + { g_@@_standard_pdf/A-4_prop }{min_pdf_version}{2.0} +\prop_gput:cnn + { g_@@_standard_pdf/A-4_prop }{year}{2020} +\prop_gput:cnn + { g_@@_standard_pdf/A-4_prop }{Trailer_no_Info}{} +\prop_gremove:cn + { g_@@_standard_pdf/A-4_prop }{conformance} +\prop_gremove:cn + { g_@@_standard_pdf/A-4_prop }{max_pdf_version} % \end{macrocode} % \end{variable} % |