%%
%% This is file `aebxmp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% aebxmp.dtx  (with options: `copyright,package')
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% aebxmp.sty package,                  2011-12-29      %%
%% Copyright (C) 2006--2012 D. P. Story                 %%
%%   dpstory@uakron.edu                                 %%
%%                                                      %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1 of the  %%
%% License, or (at your option) any later version.      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{aebxmp}
 [2012/01/09 v2.3 Populate advanced metadata (dps)]
\RequirePackage{xkeyval}
\ProcessOptionsX
\@ifpackageloaded{insdljs}{\let\execjs=y}
    {\RequirePackage[execJS]{insdljs}}
\newcommand{\copyrightStatus}[1]{\def\xmpcopyrightStatus{#1}}
\let\xmpcopyrightStatus\@empty
\newcommand{\copyrightNotice}[1]{\def\xmpcopyrightNotice{#1}}
\let\xmpcopyrightNotice\@empty
\newcommand{\copyrightInfoURL}[1]{\def\xmpcopyrightInfoURL{#1}}
\let\xmpcopyrightInfoURL\@empty
\newcommand{\authortitle}[1]{\def\xmpauthortitle{#1}}
\let\xmpauthortitle\@empty
\newcommand{\descriptionwriter}[1]{\def\xmpdescriptionwriter{#1}}
\let\xmpdescriptionwriter\@empty
\let\arrayOfAuthors\@empty
\let\xmpAuthors\@empty
\newcommand{\Authors}[1]{\def\xmpAuthors{#1}%
    \begingroup\let\u\relax
    \ifx\xmpAuthors\@empty\else
        \let\arrayOfAuthors\@gobble
        \@tfor\xmpAuthor:=#1\do{%
            \xdef\arrayOfAuthors{\arrayOfAuthors,"\xmpAuthor"}%
        }%
        \xdef\arrayOfAuthors{[\arrayOfAuthors];}%
    \fi
    \endgroup
}
\def\insertAuthors{\ifx\arrayOfAuthors\@empty\else
    this.info.Authors=\arrayOfAuthors^^J\fi}
\def\insertCopyrightNotice{\ifx\xmpcopyrightNotice\@empty\else
^^Jp.aebdc::rights.aebrdf::Alt.aebrdf::li[0]="\xmpcopyrightNotice";
^^Jp.aebdc::rights.aebrdf::Alt.aebrdf::li[0].@xml::lang="en";\fi}
\let\arrayOfKeywords\@empty
\let\aKeywords\@empty
\let\xmpKeywords\@empty
\newcommand{\Keywords}[1]{\def\xmpKeywords{#1}%
    \begingroup\let\u\relax\count0=0
    \def\insBagItem{%
    p.aebdc::subject.aebrdf::Bag.aebrdf::li}%
    \ifx\xmpKeywords\@empty\else
        \let\arrayOfKeywords\@gobble
        \let\aKeywords\@gobbletwo
        \@for\xmpKeyword:=#1\do{%
            \xdef\arrayOfKeywords{\arrayOfKeywords^^J%
            \insBagItem[\the\count0]="\xmpKeyword";}%
            \xdef\aKeywords{\aKeywords;\space\xmpKeyword}%
            \advance\count0by1
        }%
        \xdef\aKeywords{"\aKeywords"}%
    \fi
    \endgroup
}
\def\insertKeywords{\ifx\arrayOfKeywords\@empty\else
    \arrayOfKeywords\fi}
\def\insertaKeywords{\ifx\aKeywords\@empty\else
    this.info.Keywords=\aKeywords;^^J%
    this.addScript("Array of Keywords", '\akeywordsJS');^^J\fi}
\begin{defineJS}[\catcode`\@=0\relax]{\akeywordsJS}
function aKeywords(i) {
    var uriRdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    var uriDc="http://purl.org/dc/elements/1.1/";
    var meta=this.metadata;
    var aebXMPData=new XML(meta);
    var aebrdf=@xNNS(uriRdf);
    var aebdc=@xNNS(uriDc);
    var p=aebXMPData.aebrdf::RDF.aebrdf::Description;
    return p.aebdc::subject.aebrdf::Bag.aebrdf::li[i];
}
aKeywords.doc=this;
aKeywords.toString=function() {return aKeywords.doc.info.Keywords;}
\end{defineJS}
\let\insertCusProps\@empty
\newcommand\customProperties[1]{\def\pdfx@cusProps{#1}%
    \begingroup\let\u\relax
    \@tfor\thisproperty:=#1\do{%
    \edef\tmp@exp{\noexpand
    \setkeys{pdfx@cusPropKV}{name,value,\thisproperty}}\tmp@exp
    \xdef\insertCusProps{\insertCusProps^^J%
        p.aebpdfx::\pdfx@KName="\pdfx@VValue";}
    }%
    \endgroup
}
\define@key{pdfx@cusPropKV}{name}[]{\def\pdfx@KName{#1}}
\define@key{pdfx@cusPropKV}{value}[]{\def\pdfx@VValue{#1}}
\bgroup\obeyspaces
\gdef\tabiv{    }%
\egroup
\def\insertMarked{\ifx\xmpcopyrightStatus\@empty
    \else^^Jp.aebxapRights::Marked="\xmpcopyrightStatus";\fi}
\def\insertWebStatement{\ifx\xmpcopyrightInfoURL\@empty
    \else^^Jp.aebxapRights::WebStatement="\xmpcopyrightInfoURL";\fi}
\def\insertAuthorTitle{\ifx\xmpauthortitle\@empty
    \else^^Jp.aebphotoshop::AuthorsPosition="\xmpauthortitle";\fi}
\def\insertDescriptionWriter{\ifx\xmpdescriptionwriter\@empty
    \else^^Jp.aebphotoshop::CaptionWriter="\xmpdescriptionwriter";\fi}
\def\insertCreateDate{^^Jp.aebxap::CreateDate=createDateStr;}
\def\xmpnEOL{\string\n\string\^^J}
\def\xNNS{new Namespace}
\def\xAdbNS{http://ns.adobe.com}
\def\xWiiiNS{http://www.w3.org}
\begin{execJS}{execXMP}
var meta=this.metadata;
var aebXMPData=new XML(meta);
var aebx=\xNNS("x","adobe:ns:meta/");
var xmlns=\xNNS("xmlns","\xWiiiNS/2000/xmlns/");
var xml=\xNNS("xml", "\xWiiiNS/XML/1998/namespace");
var aebrdf=\xNNS("rdf","\xWiiiNS/1999/02/22-rdf-syntax-ns#");
var aebdc=\xNNS("dc","http://purl.org/dc/elements/1.1/");
var aebpdf=\xNNS("pdf","\xAdbNS/pdf/1.3/");
var aebxap=\xNNS("xmp","\xAdbNS/xap/1.0/");
var aebxapRights=\xNNS("xmpRights","\xAdbNS/xap/1.0/rights/");
var aebphotoshop=\xNNS("photoshop","\xAdbNS/photoshop/1.0/");
var aebpdfx=\xNNS("pdfx","\xAdbNS/pdfx/1.3/");
var p=aebXMPData.aebrdf::RDF.aebrdf::Description;
p.@xmlns::pdfx=aebpdfx.uri;
p.@xmlns::photoshop=aebphotoshop.uri;
p.@xmlns::xmpRights=aebxapRights.uri;
var d=new Date();
var createDateStr=util.printd("yyyy-mm-ddTHH:MM:ss",d);
delete p.@aebdc::rights.aebrdf::Alt.aebrdf::li;
\insertKeywords%
\insertCopyrightNotice
delete p.@aebxapRights::Marked;
delete p.@aebxapRights::WebStatement;
delete p.@aebphotoshop::AuthorsPosition;
delete p.@aebphotoshop::CaptionWriter;
delete p.@aebxap::CreateDate;%
\insertMarked%
\insertWebStatement%
\insertAuthorTitle%
\insertDescriptionWriter%
\insertCusProps%
\insertCreateDate
%%</rdf:Description>
var aebNewXMPStr=aebXMPData.toXMLString();
this.metadata=aebNewXMPStr;
\insertAuthors%
\insertaKeywords%
\end{execJS}
\endinput
%%
%% End of file `aebxmp.sty'.
