%%
%% This is file `pdfx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfx.dtx  (with options: `package')
%% 
%%  Copyright (c) 2008, CV Radhakrishnan <cvr@river-valley.org>,
%%    Han The Thanh <thanh@river-valley.org>
%% 
%%  This file may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.2 of this
%%  license or (at your option) any later version.  The latest version
%%  of this license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%%  and version 1.2 or later is part of all distributions of LaTeX
%%  version 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pdfx}
  [2008/12/10 v1.2 PDF/X and PDF/A support (CVR/HTH)]

\newif\ifpdfxonea \pdfxoneafalse
\newif\ifpdfaoneb \pdfaonebfalse

\DeclareOption{a-1b}{\global\pdfaonebtrue}
\DeclareOption{x-1a}{\global\pdfxoneatrue}
\ProcessOptions

\ifpdfxonea
 \pdfminorversion=3
 \pdfpageattr{/MediaBox[0 0 595 793]
              /BleedBox[0 0 595 793]
              /TrimBox[25 20 570 773]}
\else
 \pdfminorversion=4
\fi
\def\hash{\expandafter\@gobble\string\#}
\def\amp{\expandafter\@gobble\string\&}
\def\xmpAmp{\amp\hash x0026;}
\def\sep{</rdf:li><rdf:li>}
\def\TextCopyright{\amp\hash x00A9;}
\def\Title#1{\gdef\xmpTitle{#1}}
 \let\xmpTitle\@empty
\def\Author#1{\gdef\xmpAuthor{#1}}
 \let\xmpAuthor\@empty
\def\Keywords#1{\gdef\xmpKeywords{#1}}
 \let\xmpKeywords\@empty
 \let\xmpSubject\xmpKeywords
\def\Creator#1{\gdef\xmpCreator{#1}}
 \def\xmpCreator{\@pdfcreator}
\def\Producer#1{\gdef\xmpProducer{#1}}
 \def\xmpProducer{pdfTeX}
\def\Volume#1{\gdef\xmpVolume{#1}}
 \let\xmpVolume\@empty
\def\Issue#1{\gdef\xmpIssue{#1}}
 \let\xmpIssue\@empty
\def\CoverDisplayDate#1{\gdef\xmpCoverDisplayDate{#1}}
 \let\xmpCoverDisplayDate\@empty
\def\CoverDate#1{\gdef\xmpCoverDate{#1}}
 \let\xmpCoverDate\@empty
\def\Copyright#1{\gdef\xmpCopyright{#1}}
 \let\xmpCopyright\@empty
\def\Doi#1{\gdef\xmpDoi{#1}}
 \let\xmpDoi\@empty
\def\Lastpage#1{\gdef\xmpLastpage{#1}}
 \let\xmpLastpage\@empty
\def\Firstpage#1{\gdef\xmpFirstpage{#1}}
 \let\xmpFirstpage\@empty
\def\Journaltitle#1{\gdef\xmpJournaltitle{#1}}
 \let\xmpJournaltitle\@empty
\def\Journalnumber#1{\gdef\xmpJournalnumber{#1}}
 \let\xmpJournalnumber\@empty
\def\Org#1{\gdef\xmpOrg{#1}}
 \let\xmpOrg\@empty
\def\CreatorTool#1{\gdef\xmpCreatorTool{#1}}
 \def\xmpCreatorTool{\xmpProducer}
\def\AuthoritativeDomain#1{\gdef\xmpAuthoritativeDomain{#1}}
 \let\xmpAuthoritativeDomain\@empty
\def\findUUID#1{\edef\tmpstring{\pdfmdfivesum{#1}}
     \expandafter\eightofnine\tmpstring\end}
\def\eightofnine#1#2#3#4#5#6#7#8#9\end{%
     \xdef\eightchars{#1#2#3#4#5#6#7#8}
     \fouroffive#9\end}
\def\fouroffive#1#2#3#4#5\end{\xdef\ffourchars{#1#2#3#4}
     \sfouroffive#5\end}
\def\sfouroffive#1#2#3#4#5\end{\xdef\sfourchars{#1#2#3#4}
     \tfouroffive#5\end}
\def\tfouroffive#1#2#3#4#5\end{\xdef\tfourchars{#1#2#3#4}
     \xdef\laststring{#5}}

\def\uuid{\eightchars-%
          \ffourchars-%
          \sfourchars-%
          \tfourchars-%
          \laststring}

\findUUID{\jobname.pdf}
\edef\xmpdocid{\uuid}
\findUUID{\pdfcreationdate}
\edef\xmpinstid{\uuid}
\InputIfFileExists{\jobname.xmpdata}{}{}
\RequirePackage{xmpincl}
\def\convertDate{\getYear}
{\catcode`\D=12
 \gdef\getYear D:#1#2#3#4{\edef\xYear{#1#2#3#4}\getMonth}
}
\def\getMonth#1#2{\edef\xMonth{#1#2}\getDay}
\def\getDay#1#2{\edef\xDay{#1#2}\getHour}
\def\getHour#1#2{\edef\xHour{#1#2}\getMin}
\def\getMin#1#2{\edef\xMin{#1#2}\getSec}
\def\getSec#1#2{\edef\xSec{#1#2}\getTZh}
\def\getTZh +#1#2{\edef\xTZh{#1#2}\getTZm}
\def\getTZm '#1#2'{%
    \edef\xTZm{#1#2}%
    \edef\convDate{\xYear-\xMonth-\xDay
      T\xHour:\xMin:\xSec+\xTZh:\xTZm}}
\expandafter\convertDate\pdfcreationdate
\ifpdfxonea
 \def\@pctchar{\expandafter\@gobble\string\%}
 \def\@bchar{\expandafter\@gobble\string\\}
 \immediate\pdfobj stream attr{/N 4}  file{FOGRA39L.icc}
 \edef\OBJ@CVR{\the\pdflastobj}
 \pdfcatalog{/OutputIntents [ <<
   /Type/OutputIntent
   /S/GTS_PDFX
   /OutputCondition (FOGRA39)
   /OutputConditionIdentifier (FOGRA39 \@bchar(ISO Coated v2
    300\@pctchar\space \@bchar(ECI\@bchar)\@bchar))
   /DestOutputProfile \OBJ@CVR\space 0 R
   /RegistryName(http://www.color.org)
  >> ]}
\else
 \immediate\pdfobj stream attr{/N 4}  file{sRGBIEC1966-2.1.icm}
 \edef\OBJ@RVT{\the\pdflastobj}
 \pdfcatalog{%
   /OutputIntents [ <<
   /Type /OutputIntent
   /S/GTS_PDFA1
   /DestOutputProfile \OBJ@RVT\space 0 R
   /OutputConditionIdentifier (sRGB IEC61966-2.1)
   /Info(sRGB IEC61966-2.1)
  >> ]}
\fi
\begingroup
\let\&=\xmpAmp
\ifpdfxonea
 \includexmp{pdfx-1a}
\else
 \includexmp{pdfa-1b}
\fi
\endgroup

\input glyphtounicode.tex
\input glyphtounicode-cmr.tex
\pdfgentounicode=1
\ifpdfxonea
  \RequirePackage[draft,pdftex,pdfpagemode=UseNone,bookmarks=false]{hyperref}
  \pdfinfo{
      /Title(\xmpTitle)%
      /Author(\xmpAuthor)%
      /Creator(\xmpProducer)%
      /CreationDate(\convDate)%
      /ModDate(\convDate)%
      /Producer(\xmpProducer)%
      /Trapped /False
      /GTS_PDFXVersion (PDF/X-1:2001)%
      /GTS_PDFXConformance (PDF/X-1a:2001)%
  }
\else
  \RequirePackage[pdftex,pdfa]{hyperref}
 \def\PDF@FinishDoc{%
  \Hy@UseMaketitleInfos
  \pdfinfo{%
     /Creator(\xmpProducer)%
     \ifx\@pdfcreationdate\@empty
    \else
      /CreationDate(\@pdfcreationdate)%
    \fi
    \ifx\@pdfmoddate\@empty
    \else
      /ModDate(\@pdfmoddate)%
    \fi
      /Producer(\xmpProducer)%
     /Trapped /False
     /GTS_PDFA1Version (PDF/A-1b:2005)%
  }%
  \Hy@DisableOption{pdfauthor}%
  \Hy@DisableOption{pdftitle}%
  \Hy@DisableOption{pdfsubject}%
  \Hy@DisableOption{pdfcreator}%
  \Hy@DisableOption{pdfcreationdate}%
  \Hy@DisableOption{pdfmoddate}%
  \Hy@DisableOption{pdfproducer}%
  \Hy@DisableOption{pdfkeywords}}
\fi
\endinput
%%
%% End of file `pdfx.sty'.
