From 55f834f428a0c05dedecc8d33a1c5300e58c91fc Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 24 Feb 2021 03:01:25 +0000 Subject: CTAN sync 202102240301 --- .../hyperxmp-patches-tmp-ltx.sty | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty (limited to 'macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty') diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty new file mode 100644 index 0000000000..e0cb3a4e1b --- /dev/null +++ b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty @@ -0,0 +1,139 @@ +%% This is file `hyperxmp-patches-tmp-ltx.sty" +% Copyright (C) 2019-2021 The LaTeX Project +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% https://www.latex-project.org/lppl.txt +% +% This file is part of the "pdfmanagement bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/pdfresources +% +% for those people who are interested. +\NeedsTeXFormat{LaTeX2e}[2020/10/01] +\ProvidesExplPackage{hyperxmp-patches-tmp-ltx} + {2021-02-22} {0.95a} + {Store hyperref metadata in XMP format / temporay patches to test pdfresource management ... UF} + +\cs_if_exist:NT \pdfmanagement_add:nnn + { + \pdfmanagement_if_active:T + { + \renewcommand\hyxmp@embed@packet{\hyxmp@embed@packet@generic} + } + } + +% +\newcommand*{\hyxmp@embed@packet@generic} + {% + \typeout{} + \typeout{!!~new-hyperxmp--generic~packet~command~used!!}{} + \typeout{} + \hyxmp@construct@packet + %or some other command to write a object: + \exp_args:Nnx + \pdf_object_unnamed_write:nn{stream}{{/Type~/Metadata~/Subtype~/XML}{\hyxmp@xml}}% + % reference in the Catalog: + \pdfmanagement_add:nnx {Catalog} {Metadata}{\pdf_object_ref_last:} + } + +% A standard should be retrieved from the document settings. +\cs_new:Npn \__hypxmp_get_Astandard:w #1-#2#3#4\q_stop + { + \tl_if_eq:nnT{#1}{A} + { + \Hy@pdfatrue + \tl_set:Nn \@pdfapart{#2} + \tl_set:Nx \@pdfaconformance{#3} + } + } +\cs_new_protected:Npn \__hyxmp_get_metadata: + { + \exp_last_unbraced:Ne \__hypxmp_get_Astandard:w + {\GetDocumentProperties{document/pdfstandard}}Z-ZZZ\q_stop + \clist_map_inline:nn + { + % hyperxmp keys: + ,pdfcopyright + ,pdftype + ,pdflicenseurl + ,pdfauthortitle + ,pdfcaptionwriter + ,pdfmetalang + %,pdfapart %document + %,pdfaconformance %document + ,pdfuapart %probably document too but later ... + ,pdfxstandard + ,pdfsource + ,pdfdocumentid + ,pdfinstanceid + ,pdfversionid + ,pdfrendition + ,pdfpublication + ,pdfpubtype + ,pdfbytes + ,pdfnumpages + ,pdfissn + ,pdfeissn + ,pdfisbn + ,pdfbookedition + ,pdfpublisher + ,pdfvolumenum + ,pdfissuenum + ,pdfpagerange + ,pdfdoi + ,pdfurl + ,pdfidentifier + ,pdfsubtitle + ,pdfpubstatus + ,pdfcontactaddress + ,pdfcontactcity + ,pdfcontactregion + ,pdfcontactpostcode + ,pdfcontactcountry + ,pdfcontactphone + ,pdfcontactemail + ,pdfcontacturl + ,pdfdate + %hyperref, needs probably special handling + ,pdftitle + ,pdfsubject + ,pdfkeywords + ,pdfproducer + } + { + \tl_if_exist:cF{@##1}{\tl_new:c{@##1}} + \tl_set:cx {@##1}{\GetDocumentProperties{hyperref/##1}} + } + + % pdfauthor, this is only a work around for simple author + % TODO needs improvement + \pdfstringdef\@pdfauthor{\GetDocumentProperties{hyperref/pdfauthor}} + \cs_set_eq:NN\hyxmp@pdfauthor\@pdfauthor + + % pdflang, + \tl_if_exist:cF{@pdflang}{\tl_new:c{@pdflang}} + \tl_set:cx {@pdflang}{\GetDocumentProperties{document/lang}} + } + +% we need to provide a few commands so that hyperxmp stops to overwrite them +% in \AtEndPreamble +\AddToHook{begindocument/before}[pdfmanagement/firstaid/hyperxmp]{% + \def\@pdfauthor{Author}\def\@pdftitle {Title}} + +\DeclareHookRule{begindocument/before}{pdfmanagement/firstaid/hyperxmp}{before}{hyperxmp} + +\AddToHook{enddocument}[pdfmanagement-firstaid]{\__hyxmp_get_metadata:} + +\DeclareHookRule{enddocument}{pdfmanagement-firstaid}{before}{hyperxmp} + + +\endinput -- cgit v1.2.3