PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Feb 24, 2018 7:59 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Feb 08, 2018 3:38 pm 
Offline

Joined: Thu Feb 08, 2018 9:07 am
Posts: 2
Hello, can someone confirm whether or not the current GDI build of Migradoc & PDFSharp available on Nuget (v1.50.4589.0) supports the use of private fonts and if so which mechanism should be used to load them? (i.e. IFontResolver or XPrivateFontCollection).

I have tried both approaches and have had more success with the XPrivateFontCollection approach but still have rendering issues with this so i was hoping to confirm the recommended approach before trying to progress this further.

I am attempting to load the 'font awesome' font from an embedded resource (.ttf file) and although both of the above approaches appear to load the font successfully the IFontResolver scenario renders the text characters as rectangles.

In the XPrivateFontCollection scenario the text renders ok in certain areas but fails (i.e. renders as rectangles) when used in paragraphs embedded in text frames. I am sure this is down to my lack of understanding of how all of this hangs together (i am new to this library) but i have seen a few posts that suggest i shouldn't be using the XPrivateFontCollection approach.

The background to this is that ultimately I need to render pdf documents in both Debain and Windows environments and be able to support Cyrillic (and others) unicode characters so, as a proof of concept, i am attempting to get the generation running with Cyrillic characters under a windows environment before trying it out on Debian. It seemed like a sensible approach to use a common embedded private font as opposed to attempting to deduce a suitable font under each host environment.

Many thanks


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 4:17 pm 
Offline
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 322
Location: CCAA
Hi!

Quote:
IFontResolver is new with PDFsharp 1.50.
It cannot be used with the GDI build of PDFsharp.
It cannot be used with the WPF build of PDFsharp if you want to use the DocumentPreview - fonts used with IFontResolver are not available in the preview.

Source:
http://pdfsharp.net/wiki/Private%20Fonts.ashx

WPF build and IFontResolver works fine.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 08, 2018 5:25 pm 
Offline

Joined: Thu Feb 08, 2018 9:07 am
Posts: 2
Hi, thanks for clarifying.

I think the core build without GDI+ is ultimately what I need but i appreciate that this may be a while off. I will have a go with system fonts and the GDI build for now under windows and then look at the Debian scenario once i have the basics needs covered.


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 4 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:  
cron
Powered by phpBB® Forum Software © phpBB Group