summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty')
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty45
1 files changed, 35 insertions, 10 deletions
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
index 0f0c22f831..70b83b44f8 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
@@ -19,7 +19,7 @@
%
% for those people who are interested.
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesExplPackage{hyperxmp-patches-tmp-ltx}{2022-04-14}{0.95n}
+\ProvidesExplPackage{hyperxmp-patches-tmp-ltx}{2022-05-11}{0.95o}
{Store hyperref metadata in XMP format / temporay patches to test pdfresource management ... UF}
\cs_if_exist:NT \pdfmanagement_add:nnn
@@ -45,19 +45,27 @@
}
% A standard should be retrieved from the document settings.
-\cs_new:Npn \__hypxmp_get_Astandard:w #1-#2#3#4\q_stop
+\cs_new:Npn \__hypxmp_get_Astandard:
{
- \tl_if_eq:nnT{#1}{A}
+ \exp_args:Ne \tl_if_eq:nnT{\pdfmeta_standard_item:n{type}}{A}
{
\Hy@pdfatrue
- \tl_set:Nn \@pdfapart{#2}
- \tl_set:Nx \@pdfaconformance{#3}
+ \tl_set:Nx \@pdfapart{\pdfmeta_standard_item:n{level}}
+ \tl_set:Nx \@pdfaconformance{\pdfmeta_standard_item:n{conformance}}
}
}
+% A-4 will need also the year, so we have to extend the schema
+\renewcommand*{\hyxmp@pdfa@id@schema}{%
+ \ifHy@pdfa
+ \exp_args:Nnx\hyxmp@add@simple{pdfaid:part}{\pdfmeta_standard_item:n{level}}
+ \exp_args:Nnx\hyxmp@add@simple{pdfaid:conformance}{\pdfmeta_standard_item:n{conformance}}
+ \exp_args:Nnx\hyxmp@add@simple{pdfaid:rev}{\pdfmeta_standard_item:n{year}}
+ \fi
+}
+
\cs_new_protected:Npn \__hyxmp_get_metadata:
{
- \exp_last_unbraced:Ne \__hypxmp_get_Astandard:w
- {\GetDocumentProperties{document/pdfstandard}}Z-ZZZ\q_stop
+ \__hypxmp_get_Astandard:
\clist_map_inline:nn
{
% hyperxmp keys:
@@ -146,9 +154,26 @@
\DeclareHookRule{begindocument/before}{pdfmanagement/firstaid/hyperxmp}{before}{hyperxmp}
-\AddToHook{enddocument}[pdfmanagement-firstaid]{\__hyxmp_get_metadata:}
-
-\DeclareHookRule{enddocument}{pdfmanagement-firstaid}{before}{hyperxmp}
+% hyperxmp puts the code into enddocument, but for xetex this is too late.
+% so we move that to shipout/lastpage and add our command before.
+% the luatex code must stay in enddocument as hyperxmp tries to detect the pdf size
+% there.
+\sys_if_output_dvi:TF
+ {
+ \RemoveFromHook{enddocument}[hyperxmp]
+ \AddToHook{shipout/lastpage}[pdfmanagement-firstaid]
+ {
+ \__hyxmp_get_metadata:
+ \hyxmp@auto@assign@data
+ \hyxmp@check@standards
+ \hyxmp@warn@if@no@metadata
+ \hyxmp@embed@packet
+ }
+ }
+ {
+ \AddToHook{enddocument}[pdfmanagement-firstaid]{\__hyxmp_get_metadata:}
+ \DeclareHookRule{enddocument}{pdfmanagement-firstaid}{before}{hyperxmp}
+ }
\endinput