I am currently writing my master's thesis and therefor I switched from pdfLaTex, which I was using earlier for my academic texts to XeTeX, because of the simplified workflow and unicode support. I am running MiKTeX under Windows and I am struggling with including one particular PDF. I am already including other PDF files without any problems, but the last one is driving me crazy. It's the statement of authorship, provided by my university. It can be found here. Note that including this PDF works fine when I build my project using pdfLaTeX. But when building using XeLaTeX, only blank pages are included.

So I started searching around the web for some useful information and I came up with some solutions, but none of them worked so far. So let me explain, what I have already tried.

First attempt: Rebuilding the PDF

First I tried to rebuild the PDF with GhostScript as described here. Basically I ran the following code:

pdf2ps auth_statement.pdf auth_statement.ps
ps2pdf auth_statement.ps auth_statement_new.pdf

This worked, however the font was totally messed up when including the newly generated PDF. Umlauts did not work at all. I also tried running ps2ps in between, as suggested in the linked answer, but this produced a 0 byte file.

Second attempt: pdfLaTeX + XeLaTeX

So I started writing a MWE and came over with the idea of including the PDF into a simple document, compiled with pdfLaTeX and use this output in my actual thesis. This works, but somehow affects the build of my thesis. Everything runs fine, I do not receive any errors, but the final PDF file is deleted immediately after the build process.

Now I am running out of ideas. Do you know how to check what causes the PDF to be included incorrectly? What else should/could I try?

Here's my MWE:

    11pt,          % 11pt, 12pt
    a4paper,       % a4wide



Works fine when compiled with pdfLaTeX, but doesn't when compiled with XeLaTeX. I renamed the PDF linked above to auth_statement.pdf.

Thanks in advance!

  • 1
    xdvipdfmx warns that the document is encrypted: xdvipdfmx:warning: PDF document is encrypted. xdvipdfmx:warning: pdf: image inclusion failed for "./testimage.pdf". xdvipdfmx:warning: Could not find image resource... – Ulrike Fischer May 12 '17 at 9:05
  • @UlrikeFischer Thanks for the answer. How did you get this warning? It does not appear in the log for me. However, XeTeX informs me, that it automatically detected the driver dvipdfm (instead of xdvipdfmx). Am I missing something here? – Carsten May 12 '17 at 9:25
  • 1
    I compiled in two steps on the command line: xelatex --no-pdf file and then xdvipdfmx file. – Ulrike Fischer May 12 '17 at 10:29

I finally fixed the issue. The comment by @UlrikeFischer pointed me into the right direction. Indeed the PDF appeared to be encrypted somehow. I have no idea why pdfLaTeX did accept it without any problems and why there was no hint about the encryption in my log in the first place.

I found this answer, suggesting to repair the PDF with PDF ToolKit. I tried this with the original PDF, but failed due to the missing password. So I tried it with my resulting PDF from my second attempt and used this one as an input for my thesis. This finally worked.

  • 1
    Another trick which sometimes works is to print to file or use a PDF 'printer' (there's one for CUPS - not sure how useful this might be on Windows, though). I've managed to print a password-protected-printing-prohibited PDF this way, for example. (I didn't have the password, obviously.) – cfr May 12 '17 at 11:21
  • Thanks for the hint, I also tried this beforehand with the default Windows PDF printer, but apparently it only copies the file, if it's already PDF. Did not investigate this further, but sounds reasonable to also try this. – Carsten May 12 '17 at 12:48
  • 1
    On Linux, it definitely changes it. But I know nothing about Windows, so no help there, I'm afraid. – cfr May 12 '17 at 12:51

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.