haskell-do icon indicating copy to clipboard operation
haskell-do copied to clipboard

Added export PDF functionality

Open juanjoman opened this issue 8 years ago • 2 comments

juanjoman avatar Aug 05 '17 11:08 juanjoman

Just remembered this PR, Looks like margins and syntax highlighting is not exported properly, maybe it is possible to fix it?

NickSeagull avatar May 05 '18 13:05 NickSeagull

Using wkhtmltopdf is always tricky, you might want to check the manual, there are a few options for setting document margins and other interesting details:

  ...
  -B, --margin-bottom <unitreal>      Set the page bottom margin
  -L, --margin-left <unitreal>        Set the page left margin (default 10mm)
  -R, --margin-right <unitreal>       Set the page right margin (default 10mm)
  -T, --margin-top <unitreal>         Set the page top margin
  ...

Regarding to syntax highlight, you might need to check if the current syntax highlighter CSS is restricted to @media screen, as that CSS is not rendered if you "print" the document.

There are also some CSS tricks that might be useful

In Rails, there are some gems to use wkhtml2pdf in a friendlier manner: wicked_pdf and pdfkit. If we end up doing the effort to get this right, it might be useful to have a wrapper library for haskell. There's even a C library that could be used to make a cleaner integration, I can't wait for the fun :-D

javiertoledo avatar Jun 05 '18 21:06 javiertoledo