9

Solution

Full solution for producing PDF/X compliant document can be found in MWE and answer to this question: Disabling all document interactivity (for PDF/X compliance)

Adapted MWE and compilation method are taken from Leonid's answer to this question.

Please note that solution requires compilation with TeXLive 2015 (or later).

Original question

I am trying to compile my source with XeLaTeX to produce PDF/X-1a:2001 compliant document. Getting PDF/X-1a:2001 is possible with pdfx package (while using up-to-date TeX distribution), but only when document is compiled with pdflatex.

Since I am using OTF and TTF fonts in my document, I have to use XeLaTeX to compile it. This is MWE:

\documentclass{book}
\usepackage[x-1a1]{pdfx}
\begin{document}
Some text
\end{document}

When I try to compile this document with MiKTeX's 2.9 xelatex I get following error and compilation halts:

! Undefined control sequence.
l.111 \pdfminorversion
                      =4 %  assumed for PDF/A ;  options may change this for...

? 

Is there any way to compile PDF/X-1a:2001 with XeLaTeX, either using pdfx or different package?

Ps. I used MiKTeX 2.9, because I don't want to update my TeX Live 2013/Debian distribution I normally use. With MiKTeX I get most recent version of pdfx package.

EDIT: Since it isn't obvious from Leonid's answer and is mentioned only in comments, please note that you need TeXLive 2015 in order for Leonid's answer to work fully. TeXLive 2013 (installed by your system's package manager) or MiKTeX 2.9 won't do the trick (this is true as of March 2016; it might change by the time you read this).


I also tried to compile this MWE with LuaLaTeX to see if this works. It didn't. I get following error:

! Undefined control sequence.
\pdfx@findUUID ... \pdfx@tmpstring {\pdfmdfivesum 
                                                  {#1}} \expandafter \pdfx@e...
l.360 \pdfx@findUUID{\jobname.pdf}

?

In the event version of LuaLaTeX matters: lualatex --version outputs

This is LuaTeX, Version beta-0.76.0-2013062821  (MiKTeX 2.9 64-bit) (rev 4627)
  • Have you tried compiling with LuaTeX? pdfx is clearly designed only to support pdfTeX. However, it would be worth seeing what you get with LuaTeX, at least. To answer the question asked on your previous post, I'm not aware of a way to do this with XeTeX. But I use pdfTeX 99.999999999% of the time, so others are more likely to be aware of your options than I am. – cfr Jul 16 '15 at 11:30
  • @cfr I thought about it earlier, but unfortunately error is very similar to xelatex compilation. I updated my question to include that information. – Rafal Jul 17 '15 at 8:11
  • 1
    Last time I checked this (tex.stackexchange.com/questions/242303/…) worked with LuaLaTeX. – DG' Jul 17 '15 at 9:35
8

You need to put some specific metadata inside resulting pdf with \special command, add some info with hyperref package and then compile with xelatex option -output-driver="xdvipdfmx -V 3". Look at example:

% !TeX program = xelatex 
%%%%Needs to be compiled with commandline: "xelatex.exe -output-driver="xdvipdfmx -V 3" %.tex" % as PDF 1.3 required by PDF/X
\documentclass{book}

%%%%%%%%% PDF-X stuff, IF USING xelatex %%%%%%%%%
%(mm size * 72)/25.4 = bp size
\usepackage{atbegshi}
\AtBeginShipout{% %A hook that is executed for every page (after first one)
    \special{pdf: put @thispage
      <<
        /TrimBox [0 0 210.990 162.086] %put here other numbers = size of page in bp
      >>
    }
}
\special{pdf: put @thispage
  <<
    /TrimBox [0 0 210.990 162.086] %put here other numbers = size of page in bp
  >>
}
\special{pdf:docinfo
  <<
    /GTS_PDFXVersion (PDF/X-1:2001)
    /GTS_PDFXConformance (PDF/X-1a:2001)
  >>
}

\special{pdf:put @catalog
<<
  /PageMode /UseNone
  /OutputIntents [
    <<
      /Info (none)
      /Type /OutputIntent
      /S /GTS_PDFX
      /OutputConditionIdentifier (Custom)
      /RegistryName (http://www.color.org/)
    >>
  ]
>>
}%

\usepackage{datetime} % for \pdfdate command

\usepackage{hyperref} % for \hypersetup

\hypersetup{% 
    pdftitle={DocTitle},% PDF/X document should have a title
    pdfinfo={% Setting some more PDF/X stuff for xelatex
        ModDate={D:\pdfdate},% PDF/X document should have a modification date
        Trapped={False},% PDF/X document should have Trapped tag set
    },
}


\begin{document}
Some text
\end{document}

Another example, compilable in lualatex, pdflatex and xelatex: http://gist.github.com/LSinev/98c0a40e94f4507922a8

  • Why the multiple iterations of \hypersetup? Normally, hyperref should be loaded late. Is there any particular reason to load it first here (e.g. before datetime)? – cfr Oct 31 '15 at 19:16
  • No particular reason in this case. I would personally prefer to put all pdf/x code in one block, thus multiple hypersetup can help. – Leonid Oct 31 '15 at 19:23
  • Updated example. Removed multiple \hypersetup. Put hyperref after datetime – Leonid Oct 31 '15 at 19:47
  • @Leonid When I compile your MWE and then check against PDF/X-1a:2001 with Acrobat Pro DC, I get "Document ID missing" error and information that this is reason for document being non-compliant. Do you know how to add document ID, so that PDF validates fully? – Rafal Mar 11 '16 at 12:32
  • 1
    This command is internal.At mine distribution it adds "xmpMM:DocumentID" tag without anything more than \usepackage{hyperxmp}. – Leonid Mar 13 '16 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.