error doctopdfconverter

All,

sometimes we get an error on:
          var converter = new DocToPDFConverter();
            var pdfDoc = converter.ConvertToPDF(document);

error:
System.InvalidOperationException: pItem haven't found in paragraph items
   at Syncfusion.DocIO.DLS.WParagraph.UpdateText(ParagraphItem pItem, Int32 removeTextLength, String newText)
   at Syncfusion.DocIO.DLS.WTextRange.set_Text(String value)
   at Syncfusion.DocIO.DLS.WTextRange.SplitByParagraphBreak()
   at Syncfusion.DocIO.DLS.WTextRange.SplitWidgets()
   at Syncfusion.DocIO.DLS.WTextRange.CreateLayoutInfo()
   at Syncfusion.DocIO.DLS.WidgetBase.Syncfusion.Layouting.IWidget.get_LayoutInfo()
   at Syncfusion.Layouting.LeafLayoutContext.GetNextSibling(WTextRange textRange)
   at Syncfusion.Layouting.LeafLayoutContext.GetMinWidth(WTextRange currTextRange, SizeF size, RectangleF rect)
   at Syncfusion.Layouting.LeafLayoutContext.AdjustClientAreaBasedOnTextWrap(ILeafWidget leafWidget, SizeF& size, RectangleF& rect)
   at Syncfusion.Layouting.LeafLayoutContext.Layout(RectangleF rect)
   at Syncfusion.Layouting.LCContainer.DoLayoutChild(LayoutContext childContext)
   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, DrawingContext dc, Int32 currPageIndex)
   at Syncfusion.DocIO.DLS.Rendering.DocumentLayouter.LayoutPages()
   at Syncfusion.DocIO.DLS.Rendering.DocumentLayouter.Layout(IWordDocument doc)
   at Syncfusion.DocToPDFConverter.DocToPDFConverter.ConvertToPDF(WordDocument wordDocument)
   at Diflexmo.Forwarding.Services.DocumentService.GenerateCustomsPreview(Guid customsoperationalFileId, Guid templateId, ApplicationUser user) in C:\Users\Maarten\Source\Repos\Diflexmo.Forwarding\Diflexmo.Forwarding.Services\DocumentService.cs:line 129
   at Diflexmo.Forwarding.Web.Areas.Operational.Controllers.DocumentController.GenerateCustomsOrderPreview(Guid customoperationalFileId, Guid operationalFileId) in C:\Users\Maarten\Source\Repos\Diflexmo.Forwarding\Diflexmo.Forwarding.Web\Areas\Operational\Controllers\DocumentController.cs:line 188
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)


how can we fix this?
Kind regards

1 Reply

MJ Mohanaselvam Jothi Syncfusion Team May 29, 2018 08:31 AM UTC

Hi Van,

Thank you for contacting Syncfusion support.

We have tried to reproduce the reported problem using the given details, but it works properly at our end. From the given details, we suspect that you are using MVC application at your end. For your reference, we have attached the sample application which we tried to reproduce the reported problem.

Please find the sample from the below link:
http://www.syncfusion.com/downloads/support/forum/137821/ze/DocIO_Sample454514304.zip
Note: Please find the input Word document in the “Data” folder of above sample application.


We suspect that the problem might be due to the contents in the input Word document and the code snippets used at your end.
So, could you please provide us following details:
  1.Modified sample of above along with the input Word document to reproduce the issue.
  2.Product version details which used at your end.
Thereby we will analyze further and provide you the appropriate solution at the earliest.

Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.


Please let us know if you have any other questions.

Regards,
Mohanaselvam J


Loader.
Up arrow icon