Unable to use custom fonts #6
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: gered/clj-htmltopdf#6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi; Thanks for putting out this project.
I'm having trouble getting custom fonts to render. Should something like this work?
Everything renders, but it's just using some random serif font instead. Am I missing something?
Thanks very much.
Hello,
Took me a little bit to find this, but what finally highlighted the problem was adding this bit to the
->pdf
function's third argument (the options map):That showed me that the
<div>
tag was being rendered like so:Which is obviously wrong. :-)
clj-htmltopdf just utilizes Hiccup itself for rendering HTML in Clojure/EDN form as you are doing, and hiccup doesn't know how to convert EDN-style CSS to a CSS string last I checked?
Anyway, the easiest solution for you right now is to use an actual CSS style string for inline styles like this, e.g.
After I made that change using your example, the PDF was rendered using the custom font as expected.
Hope this helps!
Wonderful! Thanks for your response!