We suggest opening the PDF document using streams instead of strings. we provide support to open an existing document from the stream by using PdfLoadedDocument class in the ASP.NET Core Platform. You can refer to the following documentation in ASP.NET core platforms for further details.
https://help.syncfusion.com/file-formats/pdf/merge-documents?cs-save-lang=1&cs-lang=csharp
Modified code:
PdfDocument finalDoc = new PdfDocument();
FileStream stream1 = new FileStream(PathConstants.DocumentMerge1, FileMode.Open, FileAccess.Read); FileStream stream2 = new FileStream(PathConstants.DocumentMerge2, FileMode.Open, FileAccess.Read); //Creates a PDF stream for merging. Stream[] streams = { stream1, stream2 };
|
Try this on your end and let us know the result