PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 10:54 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri May 25, 2018 7:53 pm 
Offline

Joined: Fri May 25, 2018 7:21 pm
Posts: 2
Hey guys,
Today I upgraded PDFSharp & MigraDoc from version 1.32 to 1.50.4845 via nuget on an old project because I read that MigraDoc could not write an image from memory stream in version 1.32. After upgrading I'm now seeing version 1.5 has broken my barcode font that was implemented with XPrivateFontCollection (This font is just included with my application).

Attachment:
barcodefonterror.png
barcodefonterror.png [ 9.53 KiB | Viewed 4019 times ]


I have been struggling on how to implement a private font (From a file) using the new FontResolver http://www.pdfsharp.net/wiki/FontResolver-sample.ashx class. Can anyone give me some pointers on how this is done?

I have also looked at the EZFontResolver class posted here http://developer.th-soft.com/developer/2015/12/11/ezfontresolver-a-generic-font-resolver-for-pdfsharp-and-migradoc/ but I got lost in it.


Top
 Profile  
Reply with quote  
PostPosted: Fri May 25, 2018 8:23 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Toad wrote:
[...] but I got lost in it.
Why not add a C# project to your solution and use EZFontResolver in that C# project?

Here is C# sample code:
viewtopic.php?p=8961#p8961
Conversion to VB.NET is left as an exercise to the reader.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri May 25, 2018 8:41 pm 
Offline

Joined: Fri May 25, 2018 7:21 pm
Posts: 2
Thanks for the reply and the link this is a great help!
Also I didn't want to add the EZFontResolver class to my project because it seemed excessive to have an entire class to handle 1 private font that I could implement before in 4 lines of code. I don't foresee using other non system fonts in this project besides the barcode font.

I was hoping for a replacement 4 liner.


Top
 Profile  
Reply with quote  
PostPosted: Sat May 26, 2018 7:10 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Toad wrote:
I was hoping for a replacement 4 liner.
IFontResolver is a new and clean interface. EZFontResolver is the four-liner for that interface (give or take a line or two).

You can still use the GDI+ build and the XPrivateFontCollection.

Classes are cheap. You can rewrite EZFontResolver in VB.NET to avoid having another assembly.

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


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 123 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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group