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.sty184
1 files changed, 0 insertions, 184 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
deleted file mode 100644
index 5c77d8ce6b..0000000000
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
+++ /dev/null
@@ -1,184 +0,0 @@
-%% 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}{2022-08-24}{0.95r}
- {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:
- {
- \exp_args:Ne \tl_if_eq:nnT{\pdfmeta_standard_item:n{type}}{A}
- {
- \Hy@pdfatrue
- \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}}
- \int_compare:nNnT{\pdfmeta_standard_item:n{level}}>{3}
- { \exp_args:Nnx\hyxmp@add@simple{pdfaid:rev}{\pdfmeta_standard_item:n{year}} }
- \fi
-}
-
-\cs_new_protected:Npn \__hyxmp_get_metadata:
- {
- \__hypxmp_get_Astandard:
- \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 %see below
- % ,pdfsubject %see below
- ,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
- \exp_args:NNe
- \pdfstringdef\@pdfauthor{\GetDocumentProperties{hyperref/pdfauthor}}
- \cs_set_eq:NN\hyxmp@pdfauthor\@pdfauthor
- \exp_args:NNe
- \pdfstringdef\@pdfsubject{\GetDocumentProperties{hyperref/pdfsubject}}
- \cs_set_eq:NN\hyxmp@pdfsubject\@pdfsubject
- \exp_args:NNe
- \pdfstringdef\@pdftitle{\GetDocumentProperties{hyperref/pdftitle}}
- \cs_set_eq:NN\hyxmp@pdftitle\@pdftitle
- \exp_args:NNe
- \pdfstringdef\@pdfcopyright{\GetDocumentProperties{hyperref/pdfcopyright}}
- \cs_set_eq:NN\hyxmp@pdfcopyright\@pdfcopyright
- % 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
-% we need also add it to the document properties to avoid stray commas
-% with empty author.
-\AddToHook{begindocument/before}[pdfmanagement/firstaid/hyperxmp]{%
- \def\@pdfauthor{Author}\def\@pdftitle {Title}%
- \tl_if_blank:eT{\GetDocumentProperties{hyperref/pdfauthor}}
- {\AddToDocumentProperties[hyperref]{pdfauthor}{Author}}
- \tl_if_blank:eT{\GetDocumentProperties{hyperref/pdftitle}}
- {\AddToDocumentProperties[hyperref]{pdfauthor}{Title}}
- }
-
-% hyperxmp recalculates pdfproduce at begin document and we should copy that definition
-\AddToHook{begindocument/end}
- {\edef\next{\noexpand\AddToDocumentProperties[hyperref]{pdfproducer}{\@pdfproducer}}\next}
-
-\DeclareHookRule{begindocument/before}{pdfmanagement/firstaid/hyperxmp}{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