diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:11:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:11:42 +0000 |
commit | c3793d244985d120d7a3456af49fc31082756168 (patch) | |
tree | 7f9b4b7acc4b0e8b8780b621f77a823c036fc419 /Master | |
parent | 9e03dd49eee57e61c49878d62fcc67a57a652a8d (diff) |
xmpincl
git-svn-id: svn://tug.org/texlive/trunk@1460 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty b/Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty new file mode 100644 index 00000000000..f89b7ac263b --- /dev/null +++ b/Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty @@ -0,0 +1,97 @@ +%% +%% This is file `xmpincl.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xmpincl.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2005 by Maarten Sneep <sneep@nat.vu.nl> +%% +%% This work is licensed under the CC-GNU GPL, the human readable license +%% can be found here, with a link to the full text on this page. +%% http://creativecommons.org/licenses/GPL/2.0/ +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{xmpincl} + [2005/02/15 v2.1 Include XMP data in pdflatex] +\RequirePackage{ifpdf} +\ifpdf\else +\PackageWarningNoLine{xmpincl}% + {Only pdflatex is supported by the xmpincl package} +\newcommand{\includexmp}[1]{% + \PackageError{xmpincl}% + {latex is not supported by the \protect\includexmp\space package}% + {You tried to include XMP metadata in DVI production.\MessageBreak + That doesn't work, and I friendly tried to warn you.\MessageBreak + Just continue and pretend nothing is wrong,\MessageBreak + but please remove the package or switch to pdflatex.} +} +\relax\expandafter\endinput +\fi +\RequirePackage{ifthen} +\newcommand*{\mcs@xmpincl@patchFile}[1]{ +\begingroup +\newwrite\xmpinclWrite +\newread\xmpinclRead +\immediate\openin\xmpinclRead #1.xmp +\immediate\openout\xmpinclWrite #1.xmpi +\newcommand{\mcs@xmpinclStart}% + {<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> } +\newcommand{\mcs@xmpinclStartAlt}% + {<?xpacket begin='' id=''?> } +\newcommand{\mcs@xmpinclEnd}% + {<?xpacket end='r'?> } +\catcode`\#=12 +\immediate\read\xmpinclRead to\xmpinclReadln% +\ifthenelse{% + \equal{\mcs@xmpinclStart}{\xmpinclReadln}% + \or% + \equal{\mcs@xmpinclStartAlt}{\xmpinclReadln}% +}% +{% + \immediate\write\xmpinclWrite{\mcs@xmpinclStart}% +}% +{% + \immediate\write\xmpinclWrite{\mcs@xmpinclStart}% + \immediate\write\xmpinclWrite{\xmpinclReadln}% +}% +\loop% + \immediate\read\xmpinclRead to\xmpinclReadln% + \ifthenelse{% + \equal{\mcs@xmpinclEnd}{\xmpinclReadln}% + }{% Note: no if. + }{% + \if\par\xmpinclReadln\else% + \immediate\write\xmpinclWrite{\xmpinclReadln}% + \fi% + }% + \ifeof\xmpinclRead\else% +\repeat +\immediate\write\xmpinclWrite{\mcs@xmpinclEnd} +\immediate\closein\xmpinclRead +\immediate\closeout\xmpinclWrite +\endgroup +} +\newcommand{\includexmp}[1]{% + \IfFileExists{#1.xmp}{ + \mcs@xmpincl@patchFile{#1} + \begingroup + \pdfcompresslevel=0 + \immediate\pdfobj stream attr {/Type /Metadata /Subtype /XML} + file{#1.xmpi} + \pdfcatalog{/Metadata \the\pdflastobj\space 0 R} + \endgroup + } + {\newcommand{\mcs@xmpincl@filename}{#1.xmp} + \PackageError{xmpincl}% + {The file \mcs@xmpincl@filename\space was not found} + {The file \mcs@xmpincl@filename\space The metadata file + wasn't found.\MessageBreak Oops.} + } +} +\endinput +%% +%% End of file `xmpincl.sty'. |