Automatically update your publication list using R scholar II - get a PDF


Alessio apparently read my blog post on how to automatically update your publication list using R and google scholar. He contacted me wondering if there is also a solution to get a PDF. Good question, thanks!

There are probably a few ways to get a PDF. Fancy ones might include the use of knitr or the great pandoc converter, likely involving a intermediate TEX file or so. Here, however, I tried to aim for a fast and straight-forward workaround.

Let us assume we already have a HTML version of our publication list, for example, obtained as described in the post mentioned above. Converting HTML to PDF can be a bit of a nightmare, particularly if you want to maintain the CSS style of your website. What works for me is to use the Google Chrome API function chrome_print of the R package pagedown. It is not very flexible, but you pretty much get what you already have on the HTML page in your PDF - with a single command. The only requirement, you need to have Google Chrome installed.

Here is my publication list as PDF.

library(pagedown)

chrome_print(
  # link to my publication list w/o header/footer in html
  "https://thackl.github.io/publications-clean",
  # the pdf to generate
  "publications.pdf"
)