I want to create a pdf/a-compatible file in LaTeX using the pdfx package. Unfortunately, instead of using the correctly created xmp file to convert the file into pdf/a, some lines of cryptic text are written directly into the pdf file. My minimal example (largely based on http://www.golatex.de/pdfx-bzw-pdf-a-oder-pdf-x-t4427.html) is

    \Keywords{pdfTeX\sep PDF/X-1a\sep PDF/A-b}
    \Title{Sample LaTeX input file}
    \Author{Das war KOMA}


Hello world!

This produces the error ! LaTeX Error: Missing \begin{document}, although I have a \begin{document} in the file, and the following file:

enter image description here

Any ideas where the problem lies?

  • 1
    Your MWE throws no errors and compiles fine, BUT it does not produce a PDF/A-1b compliant pdf file. More on that here.
    – DG'
    Commented Mar 12, 2015 at 19:23

2 Answers 2


You need eciRGB_v2.icc in the working directory.


% ===============================
% Embedding the color profile.
% Requires eciRGB_v2.icc in the working directory
% http://www.eci.org/_media/downloads/icc_profiles_from_eci/ecirgbv20.zip

\pdfminorversion 4
\immediate\pdfobj stream attr{/N 3}  file{eciRGB_v2.icc}
/OutputIntents [ <<
/Type /OutputIntent
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (eciRGB v2)
/Info(eciRGB v2)
>> ]

\usepackage[pdftex, pdfa, linktoc=none]{hyperref}

% ----------------------------------------------
% Add metadata

       pdftitle={Sample LaTeX input file},
       pdfauthor={Das war KOMA},
       pdfkeywords={pdfTeX, PDF/X-1a, PDF/A-b},

    Hello world!

The error:

LaTeX Error: Missing \begin{document}

is triggered whenever something ends up in TeX's typesetting lists before the real \begin{document} command has been encountered. This can happen when bytes end up in the .xmpdata file, not contained as arguments of its special macros \Title, \Author, \Subject, etc. This can include invisible characters.

Have you, by any chance, copied a Byte-order marker (BOM) into the filecontents* environment, having produced its content in another editor? Having just become acquainted with this kind of problem, the next version of pdfx.sty has coding to prevent any such extraneous bytes making it into TeX's lists.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .