From b23525e6e9edb32c2ef53c319ba3e03f3b408dda Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 4 Jul 2016 21:57:47 +0000 Subject: hyperxmp (4jul16) git-svn-id: svn://tug.org/texlive/trunk@41626 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty | 108 ++++++++++++++++------ 1 file changed, 78 insertions(+), 30 deletions(-) (limited to 'Master/texmf-dist/tex/latex/hyperxmp') diff --git a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty index c94b75f5372..6db69921c0c 100644 --- a/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty +++ b/Master/texmf-dist/tex/latex/hyperxmp/hyperxmp.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{hyperxmp} - [2016/04/27 v2.9 Store hyperref metadata in XMP format] + [2016/07/04 v3.0 Store hyperref metadata in XMP format] \edef\hyxmp@dq@code{\the\catcode`\"} \catcode`\"=12 @@ -576,7 +576,7 @@ disabled}% \bgroup \xdef\hyxmp@xml{}% \hyxmp@add@to@xml{% -__________________________________________________^^J% +_______________________________________________________________^^J% } \xdef\hyxmp@padding{\hyxmp@xml}% \egroup @@ -606,24 +606,28 @@ __________________________________________________^^J% \def\hyxmp@parse@tz#1'#2'{% #1:#2% } -\def\hyxmp@today@define{% - \xdef\hyxmp@today{\the\year}% +\def\hyxmp@today@define#1{% + \xdef#1{\the\year}% \ifnum\month<10 - \xdef\hyxmp@today{\hyxmp@today-0\the\month}% + \xdef#1{#1-0\the\month}% \else - \xdef\hyxmp@today{\hyxmp@today-\the\month}% + \xdef#1{#1-\the\month}% \fi \ifnum\day<10 - \xdef\hyxmp@today{\hyxmp@today-0\the\day}% + \xdef#1{#1-0\the\day}% \else - \xdef\hyxmp@today{\hyxmp@today-\the\day}% + \xdef#1{#1-\the\day}% \fi } -\expandafter\ifx\csname pdfcreationdate\endcsname\relax - \hyxmp@today@define -\else - \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% -\fi +\@ifundefined{pdffeedback}{% + \@ifundefined{pdfcreationdate}{% + \hyxmp@today@define\hyxmp@today + }{% + \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% + }% +}{% + \edef\hyxmp@today{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate}% +} \newcommand*{\hyxmp@x@default}{x-default} \newcommand*{\hyxmp@pdf@schema}{% \hyxmp@add@to@xml{% @@ -632,8 +636,13 @@ ___________xmlns:pdf="http://ns.adobe.com/pdf/1.3/">^^J% }% \hyxmp@add@simple@var{pdf:Keywords}{@pdfkeywords}% \hyxmp@add@simple@var{pdf:Producer}{@pdfproducer}% - \@ifundefined{pdfminorversion}{}{% - \hyxmp@add@simple{pdf:PDFVersion}{1.\the\pdfminorversion}% + \@ifundefined{pdfvariable}{% + \@ifundefined{pdfminorversion}{% + }{% + \hyxmp@add@simple{pdf:PDFVersion}{1.\the\pdfminorversion}% + }% + }{% + \hyxmp@add@simple{pdf:PDFVersion}{1.\the\pdfvariable minorversion}% }% \hyxmp@add@to@xml{% ______^^J% @@ -774,14 +783,26 @@ _________\hyxmp@InstanceID^^J% ______^^J% }% } +\newcommand*{\hyxmp@define@createdate}{% + \@ifundefined{pdffeedback}{% + \@ifundefined{pdfcreationdate}{% + \hyxmp@today@define\hyxmp@createdate + }{% + \edef\hyxmp@createdate{\expandafter\hyxmp@pdf@to@xmp@date\pdfcreationdate}% + }% + }{% + \edef\hyxmp@createdate{\expandafter\hyxmp@pdf@to@xmp@date\pdffeedback creationdate}% + }% +} \newcommand*{\hyxmp@xmp@basic@schema}{% \hyxmp@add@to@xml{% ______^^J% }% - \hyxmp@add@simple{xmp:CreateDate}{\hyxmp@today}% - \hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@today}% - \hyxmp@add@simple{xmp:MetadataDate}{\hyxmp@today}% + \hyxmp@define@createdate + \hyxmp@add@simple{xmp:CreateDate}{\hyxmp@createdate}% + \hyxmp@add@simple{xmp:ModifyDate}{\hyxmp@createdate}% + \hyxmp@add@simple{xmp:MetadataDate}{\hyxmp@createdate}% \hyxmp@add@simple{xmp:CreatorTool}{\@pdfcreator}% \hyxmp@add@simple{xmp:BaseURL}{\@baseurl}% \hyxmp@add@to@xml{% @@ -990,22 +1011,27 @@ ___^^J% \ifx\hyxmp@driver\Hy@driver \hyxmp@embed@packet@pdftex \else - \def\hyxmp@driver{hdvipdfm}% + \def\hyxmp@driver{hluatex}% \ifx\hyxmp@driver\Hy@driver - \hyxmp@embed@packet@dvipdfm + \hyxmp@embed@packet@luatex \else - \def\hyxmp@driver{hxetex}% + \def\hyxmp@driver{hdvipdfm}% \ifx\hyxmp@driver\Hy@driver - \hyxmp@embed@packet@xetex + \hyxmp@embed@packet@dvipdfm \else - \@ifundefined{pdfmark}{% - \PackageWarningNoLine{hyperxmp}{% - Unrecognized hyperref driver `\Hy@driver'.\MessageBreak - \jobname.tex's XMP metadata will *not* be\MessageBreak - embedded in the resulting file}% - }{% - \hyxmp@embed@packet@pdfmark - }% + \def\hyxmp@driver{hxetex}% + \ifx\hyxmp@driver\Hy@driver + \hyxmp@embed@packet@xetex + \else + \@ifundefined{pdfmark}{% + \PackageWarningNoLine{hyperxmp}{% + Unrecognized hyperref driver `\Hy@driver'.\MessageBreak + \jobname.tex's XMP metadata will *not* be\MessageBreak + embedded in the resulting file}% + }{% + \hyxmp@embed@packet@pdfmark + }% + \fi \fi \fi \fi @@ -1020,6 +1046,28 @@ ___^^J% \pdfcatalog {/Metadata \the\pdflastobj\space 0 R}% \egroup } +\expandafter\ifx\csname pdffeedback\endcsname\relax +\else + \RequirePackage{luacode}% + \begin{luacode*} + function hyxmp_embed_packet (contents) + local n = pdf.obj { + type = "stream", + attr = [[ +/Type /Metadata +/Subtype /XML + ]], + compresslevel = 0, + string = contents + } + pdf.refobj(n) + end + \end{luacode*} +\fi +\newcommand*{\hyxmp@embed@packet@luatex}{% + \luadirect{hyxmp_embed_packet(\luastring{\hyxmp@xml})}% + \pdfextension catalog {/Metadata \the\numexpr\pdffeedback lastobj\relax\space 0 R}% +} \newcommand*{\hyxmp@embed@packet@pdfmark}{% \pdfmark{% pdfmark=/NamespacePush -- cgit v1.2.3