0

I'm trying to render a HTML page to PDF. But everytime I do this, and a font is not installed I just get random characters. -> http://cl.ly/WYCN . Also, When using a font like Helvetica a web preview via Gmail still shows these characters. I'd like to use a custom TTF font too.

What I've tried:

  1. Rendering the HTML with Helvetica -> Seems to work on all OS's but Web Preview.
  2. Rendering the HTML with Source Sans Pro (open source font, .ttf) -> Does only work on systems having Source Sans Pro installed. I did include the TTF in the bundle, added it to "Fonts required by application" and it's showing up with [UIFont familyNames].
  3. Adding @font-face in HTML for using Source Sans Pro

Is there any chance I can embed a font into a PDF using UIGraphicsBeginPDFContextToData ?

Thanks

Sjors
  • 3
  • 1

1 Answers1

0

Have a look at this: iOS Quartz embed font in pdf. It turns out that you can only embed TTF fonts, but if you follow the same procedure as he does, it should automatically be embedded. In this thread: IOS embed font in PDF they end up with the same solution. You may also want to read this: Embed custom font in a PDF generated from iPad Application because some font foundries disable embedding of their fonts (of course this does not apply to open source fonts but you may want to read it anyway).

Community
  • 1
  • 1
cutsoy
  • 10,127
  • 4
  • 40
  • 57