# How to have pdfLaTeX output PDF/X-3:2002 format pdfs?

I'm using Blurb to publish a manuscript, and they require PDF/X-3:2002 format pdfs. How do I get pdfLaTeX to output pdfs that match that specification? I'm using MiKTeX 2.9.

-
It's always good to add hyperlinks to things you are mentioning and are not known by everyone: I assume you are talking about blurb.com? –  Martin Scharrer May 11 '11 at 17:05
Have you tried this? redskiesatnight.com/books/pod/… –  Torbjørn T. May 11 '11 at 17:12
That's true, but it doesn't have much to do with the specifics of the question. –  tkerwin May 11 '11 at 17:13
possible duplicate of How to generate PDF/A and PDF/X? –  Lev Bishop May 11 '11 at 17:46
Thank you, this blog helped me solve this problem. I've written a small blog post with a more detailed explanation about the book setup using LaTeX and the memoir class, using as a reference the template cited in this thread. Creating A Compliant PDF for Blurb Book with TeX –  Enrico M. Crisostomo Nov 21 '12 at 12:56

Googling for latex blurb reveals a template that apparently does some hackery to generate a conforming PDF/X-3:2002 document.

There is also the pdfx package that could be useful.

-
That template worked, but I had to use xetex to pass -output-driver="xdvipdfmx -q -E -V 3", along with copying the special section from the example .tex file. At first it seemed like xetex had problems with my fonts, but they look good now. A separate problem is that I have PDF 1.4 images included in my document, but those are charts from R. –  tkerwin May 11 '11 at 17:50
@tkerwin: Hmm, but the template also has a pdfTeX part. –  Andrey Vihrov May 11 '11 at 17:54
pdflatex didn't recognize the -output-driver command, although there may be another way that I'm missing. –  tkerwin May 11 '11 at 18:03

I've been struggling with blurb.com's PDF/X-3:2002 requirement, and their unhelpful automatic checking that doesn't tell you much about why your file is failing the preflight tests...

Eventually I learnt what I needed to do from the createspace package and this blog post.

This minimal example below went through the tests of blurb.com all right. I compiled with lualatex. If you want to use pdflatex, you'll have to set the font without fontspec.

\documentclass[10pt,twoside]{memoir}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}

\usepackage[cmyk]{xcolor}

%% On the front page, blurb.com displays rounded values of the page sizes. For example, it would say that pocket size is 5x8 in. However, during the upload process it will display accurate values

%% blurb.com pocket size:
%% 5.125 x 8.25 in
%% 369 x 594 pts

%% Use inches! Using pt somehow produces a pdf that blurb.com recognizes as different size.
\usepackage{geometry}
\geometry{
paperwidth=5.125in,
paperheight=8.25in,
inner=15mm
}

%% http://tex.stackexchange.com/a/248911/831
\makeatletter
\edef\pwpt{\strip@pt\dimexpr0.996264009963\paperwidth\relax} %paper width in PS points
\edef\phpt{\strip@pt\dimexpr0.996264009963\paperheight\relax} %paper height in PS points
\makeatother

%% microtype, for better justification, etc.
\usepackage{microtype}
\microtypesetup{
% babel=true,
final
}

\usepackage{lipsum}

%% PDF/X-3:2002 info
%% Replace the title, author, etc. information accordingly to your book.
%% The \pageattr values have to be in pt, compare with the page size settings above.

\pdfobjcompresslevel=0%
\pdfminorversion=3%
\pdfinfo{
/Title (My Book Title)
/Author (Mr Author)
/Subject (biography)
/Keywords (humans)
/GTS_PDFXVersion (PDF/X-3:2002)
}%
\pdfcatalog{
/PageMode /UseNone
/OutputIntents [ <<
/Info (none)
/Type /OutputIntent
/S /GTS_PDFX
/OutputConditionIdentifier (Blurb.com)
/RegistryName (http://www.color.org/)
>> ]
}%

\begin{document}

\chapter{Lorem Ipsum}

\lipsum[1-150]

% an extra page to make it an even number
\newpage\mbox{}

\edef\mypdfpageattr{
/MediaBox [0 0 \pwpt\space\phpt]^^J
/BleedBox [0.00000 0.00000 \pwpt\space\phpt]^^J
/CropBox [0 0 \pwpt\space\phpt]^^J
/TrimBox [0.00000 0.00000 \pwpt\space\phpt]
}
\expandafter\pdfpageattr\expandafter{\mypdfpageattr}
\end{document}
-
Good gracious, this is horrible. Especially the need to specify the various page boxes manually baffles me. Shouldn't that be done by whatever package does the page setup anyway? Given that this answer is two years old, has the situation maybe changed for the better? –  Christian Dec 8 '13 at 17:21
@Christian if you don't want to set the boxes manually you can use this answer. –  Kpym Jun 6 at 13:41
@Kpym thanks, updated the above. –  Nyiti Jun 8 at 10:53
@Nyiti you don't need \stockwidth and \stockheight. And you should put \makeatletter and \makeatother when you use \strip@pt. –  Kpym Jun 8 at 20:53
@Kpym thanks, fixed now. –  Nyiti Jun 10 at 11:47

The wikipedia page on pdf/X standards says that PDF/X-3:2002 is based on pdf version 1.3. That should mean that a version 1.3 (or earlier) pdf will be acceptable. Put this in your preamble.

\pdfminorversion=3

Failing that, Adobe Acrobat Distiller has an option to create files that conform to PDF/X-3:2002. The Preview program that you will find on any Mac has an option to save as 'Generic PDFX-3' which might help. There is some more discussion of this issue here.

-
Most distros already have PDF 1.4 or 1.5 by default. 1.3 doesn't support images with transparency, afair. –  Andrey Vihrov May 11 '11 at 17:16
I tried uploading a PDF 1.3 and Blurb didn't accept it. I believe there are other things required for the file to be PDF/X-3:2002 –  tkerwin May 11 '11 at 17:18
It says "based on version 1.3", but this doesn't mean that simply using v1.3 is enough. Probably the PDF must support some v1.3 features so using an earlier version might not be OK, while using a higher version might be. –  Martin Scharrer May 11 '11 at 17:21

I recently posted a link to a new package "xcomply" on this web site (search for it). It might work for you. One of the choices offered is PDF/X-3:2002.

-