I need to render a page to PDF file which includes Material icons but it doesn't seem to work.
templates/pdf.html
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style>
* {
font-family: Roboto, Helvetica, sans-serif;
}
</style>
</head>
<body>
Just test
<i class="material-icons">remove_red_eye</i>
</body>
</html>
gen.py
import pdfkit
from django.template.loader import render_to_string
html = render_to_string('pdf.html')
pdfkit.from_string(html, 'out.pdf')
# I tried this version but it doesn't work either
# pdfkit.from_string(html, 'out.pdf', css=['https://fonts.googleapis.com/icon?family=Material+Icons'])
out.pdf
only contains the text Just test
. Are there any chance to fix it?
I've just also created the issue in pdfkit repo - issue