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

Struggling with FontResolver (VB.NET)
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3796
Page 1 of 1

Author:  Toad [ Fri May 25, 2018 7:53 pm ]
Post subject:  Struggling with FontResolver (VB.NET)

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 4332 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.

Author:  TH-Soft [ Fri May 25, 2018 8:23 pm ]
Post subject:  Re: Struggling with FontResolver (VB.NET)

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.

Author:  Toad [ Fri May 25, 2018 8:41 pm ]
Post subject:  Re: Struggling with FontResolver (VB.NET)

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.

Author:  TH-Soft [ Sat May 26, 2018 7:10 am ]
Post subject:  Re: Struggling with FontResolver (VB.NET)

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.

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