We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error to merge PDFs with PdfDocumentBase.Merge method - Length cannot be less than zero

Stack trace - when try to generete PDF From 2 forms with Marge Method
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.CtorCharArrayStartLength(Char[] value, Int32 startIndex, Int32 length)
at Syncfusion.Pdf.IO.PdfLexer.YyText()
at Syncfusion.Pdf.IO.PdfParser.ReadUnicodeString()
at Syncfusion.Pdf.IO.PdfParser.Simple()
at Syncfusion.Pdf.IO.PdfParser.ReadPair()
at Syncfusion.Pdf.IO.PdfParser.Dictionary()
at Syncfusion.Pdf.IO.PdfParser.Simple()
at Syncfusion.Pdf.IO.CrossTable.GetObject(IPdfPrimitive pointer)
at Syncfusion.Pdf.IO.PdfCrossTable.GetObject(IPdfPrimitive pointer)
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.get_Index()
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.GetObject()
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.get_Object()
at Syncfusion.Pdf.IO.PdfCrossTable.GetObject(IPdfPrimitive pointer)
at Syncfusion.Pdf.Interactive.PdfLoadedBookmark.GetNext()
at Syncfusion.Pdf.Interactive.PdfBookmarkBase.ReproduceTree()
at Syncfusion.Pdf.Parsing.PdfLoadedDocument.get_Bookmarks()
at Syncfusion.Pdf.Parsing.PdfLoadedDocument.CreateBookmarkDestinationDictionary()
at Syncfusion.Pdf.PdfDocumentBase.ImportPageRange(PdfLoadedDocument ldDoc, Int32 startIndex, Int32 endIndex)
at Syncfusion.Pdf.PdfDocumentBase.Append(PdfLoadedDocument ldDoc)
at Syncfusion.Pdf.PdfDocumentBase.Merge(PdfDocumentBase dest, Object[] sourceDocuments)

1 Reply

SL Sowmiya Loganathan Syncfusion Team December 18, 2019 10:00 AM UTC

Hi Josue, 
Thank you for contacting Syncfusion support.  
We have analyzed the reported issue and suspect that this to be a documents specific issue. Kindly share us the input PDF documents which you have faced the issue. It will helpful for us to provide the precise solution on this.  
Sowmiya Loganathan 

Live Chat Icon For mobile
Up arrow icon