Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
We are receiving an error when trying to convert some documents from DOC format to PDF format. The process works with some docs, but not with others.
I have attached a failing document to this ticket. We are running the DocIO library in a Linux Docker container. We are using:
SyncFusion.DocIORenderer.Net.Core 19.4.0.53
SkiaSharp.NativeAssets.Linux 2.80.3
This is the error stack trace:
--------------------------------------------------------------------------
Object reference not set to an instance of an object
at Syncfusion.Drawing.SkiaSharpHelper.Graphics.MeasureText(String text, String fontName, Single fontSize, FontStyle fontStyle, StringFormat format)
at Syncfusion.Drawing.SkiaSharpHelper.Graphics.MeasureString(String text, Font font, PointF pointF, StringFormat format, FontStyle fontStyle)
at Syncfusion.DocIO.Rendering.DrawingContext.MeasureString(String text, Font font, StringFormat format, WCharacterFormat charFormat, Boolean isMeasureFromTabList, Boolean isMeasureFromSmallCapString)
at Syncfusion.DocIO.Rendering.DrawingContext.MeasureString(String text, Font font, StringFormat format, WCharacterFormat charFormat, Boolean isMeasureFromTabList)
at Syncfusion.DocIO.DLS.WParagraph.LayoutParagraphInfoImpl.GetEmptyTextRangeSize()
at Syncfusion.DocIO.DLS.WParagraph.LayoutParagraphInfoImpl..ctor(WParagraph paragraph)
at Syncfusion.DocIO.DLS.WParagraph.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.LCContainer.DoLayoutChild(LayoutContext childContext)
at Syncfusion.Layouting.LCContainer.Layout(RectangleF rect)
at Syncfusion.Layouting.Layouter.Layout(IWidgetContainer widget, ILayoutProcessHandler handler, DrawingContext 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 DocumentConversionService.WordToPdfConverter.ConvertAsync(String bucketName, String sourceFileKey, String targetFileKey, String sourceFormat) in C:\\svc-doc-conversion\\src\\services\\WordToPdfConverter.cs:line 109
-------------------------------------------------------------
This is the code:
using var wordDocument = new WordDocument(sourceStream, FormatType.Automatic);
wordDocument.FontSettings.SubstituteFont += this.FontSettings_SubstituteFont;
using var targetStream = new MemoryStream();
using var render = new DocIORenderer();
using var pdf = render.ConvertToPDF(wordDocument);
the error occurs in the ConfertToPDF method.
Thanks,
Joel