PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Using FontAwesome Font in Migradoc
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3734
Page 1 of 1

Author:  DavidM [ Tue Feb 20, 2018 2:25 pm ]
Post subject:  Using FontAwesome Font in Migradoc

Hi I am new to MigraDoc. I have successfully created a Multi-page document containing headers, tables etc. However I wish to add Font Awesome icons to the document which is saved as a PDF. However I am not sure how to add Font Awesome font to the document. Can anyone advise, with some example code?

Author:  Thomas Hoevel [ Tue Feb 20, 2018 2:33 pm ]
Post subject:  Re: Using FontAwesome Font in Migradoc

Hi!

Look here:
viewtopic.php?f=2&t=832
http://www.pdfsharp.net/wiki/Private%20Fonts.ashx
http://www.pdfsharp.net/wiki/PrivateFonts-sample.ashx

Author:  DavidM [ Tue Feb 20, 2018 2:46 pm ]
Post subject:  Re: Using FontAwesome Font in Migradoc

Hi

I have seen these examples but could not see how to use with the Font Awesome tff or woff or css font files in my app
The PDFsharp-MigraDoc-GDI NUGet package installed in my C# application.
I'd appreciate any further details.
Thanks.

Author:  Thomas Hoevel [ Tue Feb 20, 2018 3:47 pm ]
Post subject:  Re: Using FontAwesome Font in Migradoc

One option: Install the True Type font (TTF file) on your computer in the Fonts folder and use it like any other font.

Author:  DavidM [ Thu Mar 01, 2018 3:35 pm ]
Post subject:  Re: Using FontAwesome Font in Migradoc

Hi Thomas,

apologies for delay in responding I was diverted onto something else.

Your suggestion works locally. I installed the Font Awesome font on my PC and when I run my webapp locally (localhost) the migradoc document rendered as a pdf includes the Font Awesome icons.

However, running the same code on the server via IIS results in the icons not being rendered. The Font Awesome font is installed on the Server and IIS AppPool for the app and IIS IUSRS has read/execute permissions to the font file.

When investigating the pdf file created on the server fails to embed the Font Awesome font. No errors are logged or encountered when remote debig the application on the server.

Thanks for your help, any further advice would be appreciated.

Author:  Thomas Hoevel [ Mon Mar 05, 2018 9:26 am ]
Post subject:  Re: Using FontAwesome Font in Migradoc

Hi, David!
Thanks for the feedback.
DavidM wrote:
Your suggestion works locally. I installed the Font Awesome font on my PC and when I run my webapp locally (localhost) the migradoc document rendered as a pdf includes the Font Awesome icons.
Good sign. It shows the font is in a supported format.


DavidM wrote:
The Font Awesome font is installed on the Server and IIS AppPool for the app and IIS IUSRS has read/execute permissions to the font file.
PDFsharp does not read the file directly, so access for IIS IUSRS should not be required.
It most likely is a matter of permissions/privileges. If you create an AppPool with "Local System" the app should run on the server. This is just meant as a test and not recommended for production use.
I have no idea which privileges will be needed by the AppPool to make it run with minimum privileges.

Using the WPF build and the IFontResolver is my recommendation to work around this privileges issue. Make sure that your IFontResolver supports all fonts needed by your documents.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/