From c3793d244985d120d7a3456af49fc31082756168 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 13 Jan 2006 00:11:42 +0000 Subject: xmpincl git-svn-id: svn://tug.org/texlive/trunk@1460 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty | 97 +++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/xmpincl/xmpincl.sty 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 +%% +%% 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}% + { } +\newcommand{\mcs@xmpinclStartAlt}% + { } +\newcommand{\mcs@xmpinclEnd}% + { } +\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'. -- cgit v1.2.3