[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: working on hyperxmp compability (2cd1a5f)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Feb 9 19:38:57 CET 2021


Repository : https://github.com/latex3/pdfresources
On branch  : reworking-annot
Link       : https://github.com/latex3/pdfresources/commit/2cd1a5f4b743ffb0b5a896d53cae0711600ecab6

>---------------------------------------------------------------

commit 2cd1a5f4b743ffb0b5a896d53cae0711600ecab6
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Feb 9 19:38:57 2021 +0100

    working on hyperxmp compability


>---------------------------------------------------------------

2cd1a5f4b743ffb0b5a896d53cae0711600ecab6
 hyperref-generic.dtx         | 95 +++++++++++++++++++++++++++++++++++++++++---
 l3pdfmeta.dtx                | 11 ++++-
 newpackages/new-hyperxmp.sty | 57 ++++++++++++++++++++++++++
 3 files changed, 156 insertions(+), 7 deletions(-)

diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 4cb243b..e0a80ef 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -162,6 +162,35 @@
 %  affiliations and title information.
 %  \end{itemize}
 %
+%  To resolve some of this problem the driver will
+%  \begin{itemize}
+%  \item \emph{Not} try deduce author and title from documents. They have to be set in
+%  \cs{hypersetup} with |pdfauthor| and |pdftitle|. It is recommended to separate more than one
+%  author by commas, and to hide commas inside braces if needed:
+%
+%  \begin{verbatim}
+%  pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}}
+%  \end{verbatim}
+%  \item All values of relevant keys (including keys from the hyperxmp package)
+%  will be store in a Metadata container, and can be retrieved with
+%  \cs{GetDocumentMetadata}.
+%
+%  \begin{verbatim}
+%  \edef\my at pdfauthor{\GetDocumentMetadata{hyp/pdfauthor}}
+%  \end{verbatim}
+%  If the key hasn't be set, the result is empty.
+%
+%  \item |pdflang| is deprecated. Instead \cs{DeclareDocumentMetadata}
+%  should be used:
+%  \begin{verbatim}
+%  \DeclareDocumentMetadata{lang=de-DE}
+%  \end{verbatim}
+%
+%  The value can be retrieved as |document/lang|.
+%
+%  \end{itemize}
+%  \section{Dates}
+%  % XMP: yyyy-mm-ddThh:mm:ss+tt:tt, PDF: D:YYYYMMDDhhmmss+01'00'
 %
 %  \section{PDF page size (mediabox)}
 %  The standard \pkg{hyperref} driver contain code to set the PDF page size.
@@ -3493,6 +3522,8 @@
 \keys_set:nn { hyp / setup} {pdfauthor  = }
 \keys_set:nn { hyp / setup} {pdftitle   = }
 \keys_set:nn { hyp / setup} {pdfsubject  = }
+
+
 %Trapped is a bit curious, it has an value "unknown", and one can't suppress it ...
 \keys_define:nn { hyp / setup }
   {
@@ -3523,17 +3554,71 @@
        }
   }
 
+
+%%% hyperxmp keys. They are only stored as metadata:
+\clist_map_inline:nn
+  {
+   ,pdfcopyright
+   ,pdftype
+   ,pdflicenseurl
+   ,pdfauthortitle
+   ,pdfcaptionwriter
+   ,pdfmetalang
+   ,pdfapart
+   ,pdfaconformance
+   ,pdfuapart
+   ,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
+  }
+  {
+    \keys_define:nn { hyp / setup }
+      {
+        #1 .code:n= { \@@_store_metadata:nn {#1}{##1}}
+      }
+  }
+
 \cs_set_protected:Npn \PDF at SetupDoc
   {}
 
 \def\PDF at FinishDoc{}% dummy needed for hyperref ...
 
 
-\AddToHook{env/document/before}{
-  \pdf at ifdraftmode{}{
-    %!!!!! this must be handled somehow
-    \Hy at UseMaketitleInfos %get/set Title/Author from \title if pdfusetitle is true
-    }}
+%\AddToHook{env/document/before}{
+%  \pdf at ifdraftmode{}{
+%    %!!!!! this must be handled somehow
+%    %\Hy at UseMaketitleInfos %get/set Title/Author from \title if pdfusetitle is true
+%    }
+%    }
 
 
 % pdfpageduration sets the duration a page is shown in full screen mode.
diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index 28a8240..97e42de 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -185,6 +185,7 @@
 \prop_set_from_keyval:cn { g_pdfmeta_standard_pdf/A-1b_prop }
   {
     ,name             = pdf/A-1b
+    ,type             = A
     ,year             = 2005
     ,pdf_version      = 1.4        %minimum
     ,encryption       = false
@@ -250,7 +251,10 @@
 \prop_gset_eq:cc
   { g_pdfmeta_standard_pdf/A-2b_prop }
   { g_pdfmeta_standard_pdf/A-1b_prop }
-
+\prop_gput:cnn
+  { g_pdfmeta_standard_pdf/A-2b_prop }{name}{pdf/A-2b}
+\prop_gput:cnn
+  { g_pdfmeta_standard_pdf/A-2b_prop }{year}{2011}
 % embedding files is allowed (with restrictions)
 \prop_gremove:cn
   { g_pdfmeta_standard_pdf/A-2b_prop }
@@ -261,7 +265,10 @@
 \prop_gset_eq:cc
   { g_pdfmeta_standard_pdf/A-3b_prop }
   { g_pdfmeta_standard_pdf/A-2b_prop }
-
+\prop_gput:cnn
+  { g_pdfmeta_standard_pdf/A-3b_prop }{name}{pdf/A-3b}
+\prop_gput:cnn
+  { g_pdfmeta_standard_pdf/A-2b_prop }{year}{2012}
 % embedding files is allowed (with restrictions)
 \prop_gremove:cn
   { g_pdfmeta_standard_pdf/A-3b_prop }
diff --git a/newpackages/new-hyperxmp.sty b/newpackages/new-hyperxmp.sty
index 396f719..54b42dd 100644
--- a/newpackages/new-hyperxmp.sty
+++ b/newpackages/new-hyperxmp.sty
@@ -45,7 +45,64 @@
     \pdf_object_now:nn{stream}{{/Type~/Metadata~/Subtype~/XML}{\hyxmp at xml}}%
     \pdfmanagement_add:nnx {Catalog} {Metadata}{\pdf_object_last:}
  }
+
+\cs_new_protected:Npn \__hyxmp_get_metadata:
+ {
+   \clist_map_inline:nn
+    {
+      % hyperxmp keys:
+      ,pdfcopyright
+      ,pdftype
+      ,pdflicenseurl
+      ,pdfauthortitle
+      ,pdfcaptionwriter
+      ,pdfmetalang
+      ,pdfapart
+      ,pdfaconformance
+      ,pdfuapart
+      ,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
+      ,pdfauthor
+      ,pdftitle
+      ,pdfsubject
+      ,pdfkeywords
+    }
+    {\tl_set:cx {@#1}{\GetDocumentMetadata{hyp/#1}}}
+ }
+\AtEndDocument{\__hyxmp_get_metadata:}
 \ExplSyntaxOff
+\DeclareHookRule{enddocument}{newhyperxmp}{before}{hyperxmp}
 
 
 \endinput





More information about the latex3-commits mailing list.