base64-encoding the pdf is required, contrary to the ipython documentation (this only works in browsers)