I have this error duringvar pdfText = render.ConvertToPDF(wordDocument);
This only happens whenever the code set a stream to argsAlternateFontStream.
if (args.OriginalFontName.ToLower() == fontName.ToLower() && isFontStyle){
var fs= File.OpenRead(@"lobster.woff2");
args.AlternateFontStream = fs;
}
Error details.
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Syncfusion.DocIORenderer.Portable
StackTrace:
at Syncfusion.DocIORenderer.Drawing.FontExtension.get_Name()
at Syncfusion.DocIO.DLS.FontSettings.GetFont(String fontName, Single fontSize, FontStyle fontStyle)
at Syncfusion.DocToPdfConverter.Rendering.PDFDrawingContext.UpdateAlternateFont(WCharacterFormat charFormat, String fontName, Font& font)
at Syncfusion.DocToPdfConverter.Rendering.PDFDrawingContext.GetFont(WTextRange txtRange, WCharacterFormat charFormat, String text)
at Syncfusion.DocIO.DLS.WTextRange.CreateLayoutInfo()
at Syncfusion.DocIO.DLS.WidgetBase.Syncfusion.Layouting.IWidget.get_LayoutInfo()
at Syncfusion.Layouting.LCContainer.CreateNextChildContext()
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.LCLineContainer.DoLayoutChild(LayoutContext childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.LCContainer.DoLayoutChild(LayoutContext childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.LCContainer.DoLayoutChild(LayoutContext childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.Layouter.Layout(IWidgetContainer widget, ILayoutProcessHandler handler, IDrawingContext dc)
at Syncfusion.DocIO.DLS.Rendering.DocumentLayouter.LayoutPages()
at Syncfusion.DocIO.DLS.Rendering.DocumentLayouter.Layout(IWordDocument doc)
at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF(WordDocument wordDocument)
at C2C.SfTemplateEditorAPI.Domain.Services.DocumentTemplateService.d__35.MoveNext() in C:\***-documents-domain\api\Domain\Services\DocumentTemplateService.cs:line 713