Hello, I use PDFsharp-GDI 6.2.0 (nuget package) I have problem embedding fonts. I posted my Font resolver, I also tried without ... Everything I tried it shows in Adobe Reader:
DejaVu Sans (Embedded Subset) Type: TrueType (CID) Encoding: Identity-H
Why it is not fully embedded. Please help me kind people.
I call it with this: Dim options = New XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.EmbedCompleteFontFile) Dim font = New XFont("DejaVu Sans", 12, XFontStyleEx.Regular, options)
Public Class MyFontResolver Implements IFontResolver
Public Function ResolveTypeface(familyName As String, isBold As Boolean, isItalic As Boolean) As FontResolverInfo Implements IFontResolver.ResolveTypeface If familyName = "DejaVu Sans" Then Return New FontResolverInfo("dejavusans#regular", PdfFontEmbedding.EmbedCompleteFontFile) End If Throw New NotImplementedException("Font not supported: " & familyName) End Function
Public Function GetFont(faceName As String) As Byte() Implements IFontResolver.GetFont If faceName = "dejavusans#regular" Then Return File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DejaVuSans.ttf")) End If Throw New FileNotFoundException("Font not found: " & faceName) End Function End Class
|