Hello,
I’m using the Free Licence for my .NET MAUI application with Visual Studio.
When I run my app (Android) in debug mode, the PDF creation works perfectly, but in release mode I get this exception:
System.TypeInitializationException: TypeInitialization_Type, GemBox.Pdf.Content.PdfFonts
—> System.UriFormatException: net_uri_BadFormat
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri…ctor(String uriString)
at t..MoveNext()
at t.()
at t.e(String )
at .e(String )
at W.(Uri )
at W.(Assembly , String )
at W.()
at W.()
at W.(Uri , )
at W.[PdfFontFamily](Uri , String , Boolean , Func3 ) at GemBox.Pdf.Content.PdfFonts.(Uri , String , Boolean ) at GemBox.Pdf.Content.PdfFonts..cctor() Exception_EndOfInnerExceptionStack at GemBox.Pdf.Content.PdfFontFace.5b2nb4besfw93bw3sdyrelglx2easxdte() at .( ) at GemBox.Pdf.Content.PdfFontFace.GetHashCode() at .GetHashCode() at System.Collections.Generic.Dictionary
2[[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847],[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847]].TryInsert( , , InsertionBehavior )
at System.Collections.Generic.Dictionary`2[[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847],[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847]].Add( key, value)
at .( )
at .()
at GemBox.Pdf.Content.PdfFormattedText.get_FontSize()
at GemBox.Pdf.Content.PdfFormattedText.set_FontSize(Double value)
at APP.Page.CreationPDF()
Here is my code :
PdfFormattedText title= new();
title.TextAlignment = PdfTextAlignment.Center;
title.FontSize = 36;
title.FontWeight = PdfFontWeight.Bold;
title.Append(“Title”);
page.Content.DrawText(title, new PdfPoint(100, 100));
This issue only appears with Text. For example, I can create an image.
Also, if I remove title.FontSize = 36;
, the error appears on title.FontWeight = PdfFontWeight.Bold;
.
Do you have a solution ?
Thanks in advance.