9

I want to convert my test.epub to PDF format using Pandoc. I tried (given here)

pandoc -f epub -t test.epub -o outfile.pdf

which throws the following error:

cannot produce pdf output from pdf

I also tried the following command

pandoc test.epub -f epub -t latex -s -o my.pdf --latex-engine=xelatex

which throws the following error:

--latex-engine has been removed.  Use --pdf-engine instead.
Try pandoc --help for more information.

Then I tried

pandoc test.epub -f epub -t latex -s -o my.pdf --pdf-engine=xelatex

which converts the EPUB to PDF format but the final output is not very good. No respect for page break and other stuff. More number of pages than the actual. Any thoughts to convert EPUB to PDF format very efficiently.

Kurt Pfeifle
  • 4,785

3 Answers3

6

Have you tried the latest version of Pandoc, which currently is v2.5?
Have you tried to play with '--epub-chapter-level=...' numbers?
Have you tried to play with '--top-level-division=section' (or ...=part or ...=chapter) for the output?
Have you tried with the LuaLaTeX engine`?

pandoc      \
  -f epub   \
  -t latex  \
  -o my.pdf \
  --epub-chapter-level=1 \
  --pdf-engine=lualatex  \
   test.epub 

Have you tried a non-Pandoc tool like Calibre?

Kurt Pfeifle
  • 4,785
1

Using pandoc 3.1.12.1, I couldn't get images to work using -t html, so I'd recommend using latex instead. I used xelatex like this:

pandoc -V fontsize=12pt -V geometry:margin=1in -f epub -t latex -o texas.pdf --pdf-engine=xelatex texas.epub
0

EPUB -> RTF -> PDF , without Pandoc, on Ubuntu 20.04:

I've converted EPUB to Rich-Text-Format (RTF) with Ebookreader Calibre first, then opened the newly created RTF from within the Calibre GUI. (Do not look for the RTF file in your current directory).

Calibre 4.99 used my Libreoffice Writer to open the RTF. From Writer I was able to export the RTF to PDF.

This worked for a PDF that was almost exlusively text. It contained very few graphics except for chapter markers, company logos etc.

knb
  • 5,292