Hello,
I am encountering a NullReferenceException
when trying to concatenate PDF files using the PdfFileEditor.Concatenate()
method in Aspose.PDF 25.1.0 . The issue occurs specifically when the PDFs being processed contain architectural data.
The error is thrown on the following line of code:
using Aspose.Pdf.Facades;
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense("Aspose.Total.lic");
Console.WriteLine("Hello, World!");
var agendaFileTmpPath = "test1.pdf";
List<string> pdfFilesToConcatenateList = new List<string>();
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
pdfFilesToConcatenateList.Add("sample-drawing-package-1and2family.pdf");
var editor = new PdfFileEditor();
editor.CopyOutlines = false;
editor.CopyLogicalStructure = true;
editor.CorruptedFileAction = PdfFileEditor.ConcatenateCorruptedFileAction.StopWithError;
var packetTempFilePath = agendaFileTmpPath.Replace(".pdf", "_out1.pdf");
var result = editor.Concatenate(pdfFilesToConcatenateList.ToArray(), packetTempFilePath);
The NullReferenceException
is thrown at this line:
var result = editor.Concatenate(pdfFilesToConcatenateList.ToArray(), packetTempFilePath);
Expected Result: The PDF files should concatenate successfully without any exceptions, and the resulting file should be saved at the specified packetTempFilePath
.
Actual Result: A NullReferenceException
is thrown when calling editor.Concatenate()
with architectural PDFs.
Additional Information:
- The
pdfFilesToConcatenateList
is valid and notnull
, containing correct file paths. - The
agendaFileTmpPath
is properly formatted and valid. - The issue only seems to occur with PDFs containing architectural data or complex layouts.
Could you please assist in resolving this issue? Any insights or potential workarounds would be greatly appreciated.
Check this Sample file
sample-drawing-package-1and2family.pdf (2.1 MB)
Thank you!