Search code examples
ruby-on-railsrubywkhtmltopdfpdfkitgoogle-webfonts

pdfkit with google web fonts


I'm trying to create a pdf with PDFKit from a webpage with custom Google Web fonts.

I can't seem to get the custom fonts to work properly.
I'm using the default PDFKit middleware for Rails, as shown here.

Can someone please show me a .html file and the (preferably ruby) code that converts it to a pdf using PDFKit or just wkhtmltopdf. The converted pdf should have pretty fonts :)


Solution

  • We just had the same problem with wicked_pdf, which uses wkhtmltopdf, too. Our solution was to download the font and install them on the machines, which generate the pdfs. Then use the fonts like every other system font.