2

Is there a way I can convert large html file (produced with sphinx by the way) to pdf with color, table of contents (toc) and unicode support?

There's htmldoc -- but it neither support color, nor unicode.

There's rst2pdf sphinx plugin -- but currently it breaks math rendering, and also can't word-warp code lines.

There's a way to export to xetex in sphinx -- but it can't word-wrap code-blocks, and also don't support svg images.

Edit:

I tried to use pandoc:

pandoc index.html --mathjax --toc -o index.pdf

it gives:

pandoc: Error producing PDF from TeX source.
! LaTeX Error: Command \guillemotright unavailable in encoding OT1.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.55   2012-Sep-11} ยป

I'm stucked...

Adobe
  • 3,000

3 Answers3

1

If you are on linux or Mac, you can try html2pdf or html2ps foo.html; ps2pdf foo.ps. Neither of these methods is perfect but they might work.

You can also try opening the file in an office suite and export to pdf. I know that both word and libreoffice support this. This is the only option I know of if you are using windows.

The best way would be to export the file as TeX or LaTeX and compile the pdf, you can edit the LaTeX code to fix any wrapping issues. You can also easily convert your images to png using convert from ImageMagick:

$ mogrify -format png *.svg
terdon
  • 54,564
1

Have you tried wkhtmltopdf? It's based on WebKit, and has CSS support, of course with colors.

It doesn't have TOC support, err, i guess it does.

It's basically rendering to PDF.

Suncatcher
  • 1,541
  • 4
  • 23
  • 44
Rich Homolka
  • 32,350
0

Print pages to pdf firefox addon does make a toc.

Adobe
  • 3,000