Multiqc: Error creating PDF with pandoc

Created on 20 Dec 2017  ·  9Comments  ·  Source: ewels/MultiQC

Dear Phil,

I am trying to generate a simple PDF report using MultiQC to use as supplementary information for a paper. Unfortunately, the journal doesn't accept the interactive HTML report.

However, when I run MultiQC v1.3 to generate the PDF report, I receive an error that pandoc returned a non-zero exit code and no PDF report is created. Instead, I get a non-interactive HTML report.

Thanks in advance for your help!

MultiQC Error log:

[INFO   ]         multiqc : This is MultiQC v1.3
[INFO   ]         multiqc : --pdf specified. Using non-interactive HTML template.
[INFO   ]         multiqc : Template    : simple
[INFO   ]         multiqc : Searching '.'
Searching 122 files..  [####################################]  100%
[INFO   ]        cutadapt : Found 30 reports
[INFO   ]          fastqc : Found 30 reports
[INFO   ]         multiqc : Compressing plot data
[WARNING]         multiqc : Deleting    : multiqc_report.html   (-f was specified)
[WARNING]         multiqc : Deleting    : multiqc_data   (-f was specified)
[INFO   ]         multiqc : Report      : multiqc_report.html
[INFO   ]         multiqc : Data        : multiqc_data
--latex-engine has been removed.  Use --pdf-engine instead.
Try pandoc --help for more information.
[ERROR  ]         multiqc : Error creating PDF! Pandoc returned a non-zero exit code.
[INFO   ]         multiqc : MultiQC complete

Command used to run MultiQC
multiqc . --force --pdf
Operating System:
Mac OS X Yosemite v10.10.5
Python Version:
Python 3.6.2 [Python 2.7.10 installed on the same system]
Method of MultiQC installation:
pip3 install --upgrade multiqc

bug

Most helpful comment

Okay, I found a workaround here, it's that you need to pass a font name to pandoc. An example that worked for me:

pandoc swarm-diagramm-descr.md --pdf-engine=xelatex -o scheme.pdf --variable mainfont="Ubuntu Mono"

All 9 comments

Unfortunately, the journal doesn't accept the interactive HTML report.

🤦‍♂️ Will they allow it if you zip it? (seriously!)

The PDF pandoc feature of MultiQC was something that I never liked and that never really worked. It looks like Pandoc has been updated and no longer works with the command that MultiQC passes to it. What version of pandoc are you using? Whilst I can probably fix this, it won't be easy to maintain backwards compatibility with previous versions of pandoc, and to be honest I've been thinking of removing the PDF feature from MultiQC for a while now anyway (eg. see #495).

The reason that you get a non-interactive report is that --pdf forces the use of the simple template (same as -t simple). This template has no Javascript or interactivity, which is required when converting to PDF. Whether that conversion works or not, you still get the simple HTML.

If you look at the verbose log (multiqc_data/multiqc.log or -v), you should see a debug statement with the full pandoc command that is being launched. Short term, you can copy this and try to run pandoc manually from the HTML to generate a file.

To be honest, if I were you, I would probably just export the plots you want from the normal report and put together something manually. Or better still, push the journal to drop a ridiculous policy and allow HTML supplemental files.

Phil

Dear Phil,

thanks for your feedback.

Yes, I know. I responded in a similar way when I learned that the journal doesn't accept the HTML report. I am not sure if they allow if I zip it but I'll double-check.

pandoc --version shows me the following:

pandoc 2.0.5
Compiled with pandoc-types 1.17.3, texmath 0.10, skylighting 0.5.0.1

Yes, I understand why I get a non-interactive report.

I can also see the full debug statement using -v and it shows:

pandoc --standalone /path/to/my/folder/multiqc_report.html --output /path/to/my/folder/multiqc_report.pdf --latex-engine=xelatex -V documentclass=article -V geometry=margin=1in -V title=

Yes, I thought about the same possibility of exporting the plots from the normal report and put a manual report together.

Thanks again,
Jan

Ok great - so, based on the error message, something like this could work:

pandoc --standalone /path/to/my/folder/multiqc_report.html --output /path/to/my/folder/multiqc_report.pdf --pdf-engine=xelatex -V documentclass=article -V geometry=margin=1in -V title=

Maybe worth a shot. If that does work then let me know, as that's a 2 second bug fix for MultiQC..

Dear Phil,

It appears that --latex-engine has been removed. Thus, I used --pdf-engine=xelatex instead and it does seem to work to generate a PDF report.

So this is what worked:

pandoc --standalone /path/to/my/file/multiqc_report.html --output /path/to/my/file/multiqc_report.pdf --pdf-engine=xelatex -V documentclass=article -V geometry=margin=1in -V title=

I just get the following warning:
[WARNING] Missing character: There is no ≥ in font [lmroman10-regular]:mapping=tex-text;!

yup, great - does the warning prevent the PDF generation from working? I'll update the pandoc command in MultiQC.

No, the PDF is still generated successfully.

A problem I currently have with the PDF though is that, in the general stats table, my (long) sample names are overlapping with other columns making it not readable.
I was trying to use the the pandoc multiline_tables extension but without any success.
Maybe you've any idea?

yup, great - does the warning prevent the PDF generation from working?

It depends on your definition of "working". This missing character means the character is replaced with a space. E.g. I just wrote a document in cyrillic, got lots of warnings, and the resulting pdf is plain empty, barring punctuation symbols.

Okay, I found a workaround here, it's that you need to pass a font name to pandoc. An example that worked for me:

pandoc swarm-diagramm-descr.md --pdf-engine=xelatex -o scheme.pdf --variable mainfont="Ubuntu Mono"

Great! If you run MultiQC with debug logging (-v) or look in multiqc_data/multiqc.log you will see the exact command that MultiQC uses to create the PDF. You can then run this manually with whatever other options you need.

Phil

Was this page helpful?
0 / 5 - 0 ratings