Skip to content
This repository has been archived by the owner. It is now read-only.

Embed Google or Typekit fonts? #24

Closed
befreestudios opened this issue Mar 18, 2016 · 5 comments
Closed

Embed Google or Typekit fonts? #24

befreestudios opened this issue Mar 18, 2016 · 5 comments
Labels

Comments

@befreestudios
Copy link

@befreestudios befreestudios commented Mar 18, 2016

Anyone know of a way to embed google web fonts, or typekit fonts for use in a PDF ? I'm assuming you might be able to do this by way of the runnings file, but I'm at a loss. Anyone tried this before, or have any suggestions?

Thanks in advance...

@dustin-H
Copy link
Member

@dustin-H dustin-H commented Mar 19, 2016

Have you tried to just add the font link to your HTML file like this?:

<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

And use it in CSS:

font-family: 'Open Sans', sans-serif;
@dustin-H dustin-H added the question label Mar 19, 2016
@befreestudios
Copy link
Author

@befreestudios befreestudios commented Mar 21, 2016

@dustin-H Thanks, but that doesn't work. Actually when I do that it generates a blank pdf

@befreestudios
Copy link
Author

@befreestudios befreestudios commented Mar 22, 2016

FYI... for anyone interested, came across this article. We are going to try to implement this on our node server and see how it works out...

https://medium.com/@stockholmux/besting-phantomjs-font-problems-ee22795f5c0b#.rpx1cf2zi

@befreestudios
Copy link
Author

@befreestudios befreestudios commented Jun 15, 2016

@dustin-H

In case anyone is interested (and it may be worth documenting), the above solution I posted worked. Essentially we needed to have the font we wanted rendered in the pdf on the production node server server that was running the pdf-generation (the link explains in detail)...

TLDR;

Custom fonts on PhantomJS step-by-step for Ubuntu

  • Get a Type1 version of the font you need. I needed to do a conversion from TrueType— there are lots of tools to do this with.
  • Upload your Type1 font to your ‘/usr/share/fonts/type1' directory.
  • Run ‘fc-cache -fv’
  • Enjoy having PhantomJS with your new font.
@dustin-H
Copy link
Member

@dustin-H dustin-H commented Jun 16, 2016

Hi @befreestudios ,

thanks a lot for that information. I will add them to the docs soon!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.