there has been a bazillion changes in my life (finishing the Google internship and working in my startup fulltime) and I want to sum that up in another post. This is just a quick tip for people who want to generate PDF/X files with LaTeX.
Some resources:
http://ctan.org/tex-archive/macros/latex/contrib/pdfx
http://support.river-valley.com/wiki/index.php?title=Generating_PDF/A_compliant_PDFs_from_pdftex
From there, you want to make sure you handle your color profiles:
http://www.colormanagement.org/en/isoprofile.htm
One issue I run into with pdfx.sty a couple of times is a date conversion function, that in the original looks something like this:
\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
The problem with this piece of code is that it hard-codes the time format produced by \pdfcreationdate which seems to be different on different platforms (Miktex,Tex-live etc). This particular code expects the date to look like this:
D:20091202141420+05'00'
However people around the Internets are running into errors if their date has '-' instead of the '+' sign. The fix for that is simple, just substitute the sign in the above snippet. Btw the error looks like this:
! Use of \getTZh doesn't match its definition.D:20120106132719Z
l.132 \expandafter\convertDate\pdfcreationdate
The time format that I've got from \pdfcreationdate was even more off:
D:20120106135936Z
To parse this, I had to rewrite the function entirely:
\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#3{
\edef\xSec{#1#2}
\edef\convDate{\xYear-\xMonth-\xDay T\xHour:\xMin:\xSec}%
}
\expandafter\convertDate\pdfcreationdate
I will add to this article after I run the pdf through Distiller to check the PDF/X compliance.
Thanks a lot, this solution put an end to my headache :D
ReplyDelete