bbucior / drposter

Generate Academic Posters in R Markdown and CSS, inspired by 'reveal.js'
GNU General Public License v3.0
74 stars 21 forks source link

Feature Request: Export to PDF #2

Closed FrankD closed 5 years ago

FrankD commented 6 years ago

Thanks for the great package! I can get printing to PDF via Chrome to work, but it would be much more convenient to generate the PDF directly via pandoc. Given that most posters will (at least currently) be destined to get exported to PDF for printing, are you considering adding this feature?

bbucior commented 6 years ago

Thanks! I'm glad you're finding this package useful.

I was planning to implement an HTML to PDF option in one of the package maintenance Makefiles, but couldn't get headless Chrome to work properly. I hadn't realized it would be possible to modify the template to directly create a PDF, which would also streamline poster generation (instead of manually refreshing the Chrome tab then checking the print preview, which was the admittedly inefficient approach in my previous three posters).

That's awesome that pandoc can now directly work with various HTML to PDF engines. I'll try to play around with it sometime this week, unless you beat me to it. Let's keep this issue open until then.

bbucior commented 6 years ago

Unfortunately, it looks like pandoc's PDF feature won't be a good option for this project. The wkhtmltopdf engine in pandoc looked promising initially, but it does not support CSS grid and I can't figure out the options for printing in color.

On the bright side, I was able to get the --print-to-pdf flag mostly working in headless Chrome. Once I work out a few bugs, there's a possibility of adding an optional post-processing hook to the drposter renderer, which would call Chrome and automate the HTML to PDF conversion. It might be a few weeks until I get around to it, but I'll keep you posted.

jvcasillas commented 5 years ago

Hi. Thanks for your awesome work. I wanted to check and see if there are any updates regarding the addition of the post-processing hook to facilitate generating a PDF.

bbucior commented 5 years ago

Thanks for your interest! The short answer is not yet. I had started doing some work on the pdf-export branch--that version of the Makefile calls Google Chrome from the command line to convert from html to pdf. I still need to integrate that step into the RMarkdown post-processing hook (and add the option to drposter). Part of the challenge will figuring out the best way to call chrome (utils::browseURL? system2? Something built into RMarkdown?).