PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Apr 25, 2018 12:58 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Feb 20, 2018 2:25 pm 
Offline

Joined: Tue Feb 20, 2018 2:15 pm
Posts: 3
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 20, 2018 2:33 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2810
Location: Cologne, Germany
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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 20, 2018 2:46 pm 
Offline

Joined: Tue Feb 20, 2018 2:15 pm
Posts: 3
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 20, 2018 3:47 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2810
Location: Cologne, Germany
One option: Install the True Type font (TTF file) on your computer in the Fonts folder and use it like any other font.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 01, 2018 3:35 pm 
Offline

Joined: Tue Feb 20, 2018 2:15 pm
Posts: 3
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 05, 2018 9:26 am 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2810
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group