I am using Aspose.Pdf@24.7.0 to merge PDF files. My company has been using Aspose.Pdf for a long time for PDF processing. Recently, we upgraded to the latest version, but after the upgrade, the PDF merge process started causing problems. We encounter the following exceptions when trying to merge certain files using the façade method.
Previously, we used Aspose.Pdf@21.9.0, and these files merged without any issues in that version. I would like to know what is causing the issue and if any code fixes are needed.
It seems that you are encountering a System.NullReferenceException when trying to merge PDF files using the PdfFileEditor class in Aspose.Pdf version 24.7.0. This issue may arise due to several reasons, especially after an upgrade from an earlier version.
Here are some steps you can take to troubleshoot and potentially resolve the issue:
Check Input Files: Ensure that both input PDF files (Doc1.pdf and Doc_Wrong.pdf) are valid and accessible. A NullReferenceException can occur if one of the files is not found or is corrupted.
Update Code: Make sure that your code is correctly handling the file paths and that the PdfFileEditor object is properly instantiated. Here’s a simplified version of your code that you can use for testing:
Review Release Notes: Check the release notes for version 24.7.0 to see if there are any breaking changes or known issues related to the PdfFileEditor class that might affect your implementation.
Test with Different Files: Try merging different PDF files to determine if the issue is specific to the files you are currently using. This can help isolate whether the problem lies with the files or the code.
Contact Support: If the issue persists after trying the above steps, consider reaching out to Aspose support with detailed information about the exception and the files you are using. They may provide insights specific to the version you are using.
By following these steps, you should be able to identify the cause of the exception and find a suitable solution.
Sources:
No specific sources were referenced in this response.
This is not a filepath issue. The TD occurs with PDFs that contain bookmarks and comments. Additionally, this worked fine in earlier versions of Aspose.Pdf.
@riyasvk
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-58479
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@riyasvk
I tried to replicate your issue with 24.7 and latest version
I couldn’t reproduce it fully as I don’t get exception
However TryConcatenate fails for both version so I added task for this issue
Did I understand you correctly that issue isn’t present in that version?
as for exception - could you provide a bit more about version of framework and OS you are using?
I am using the Aspose.PDF package for .NET Framework 4.0, version 24.7 (DLLs only). I have also tried the latest version of Aspose.PDF, but it has the same issue.
@riyasvk
I checked with mentioned framework, still the only issue I get is failed concatenation
Stack Trace gives error that “Aspose.Pdf.dll is unknown”, so I guess there could be some installation issues
Could you check if this issue is machine specific if it’s possible?
I’m using the Aspose.PDF package for .NET Framework 4.0, version 24.7. It is a DLL-only version, so it is not an installation issue. If you are not encountering the error, please try enabling common language exceptions. I created a console application to test this, and I was able to get the error messages (environment: Windows 11, Visual Studio 2022).
@riyasvk
I checked with CL exceptions, in Windows 10 it still isn’t present
I’ll add this to task description anyway and try to emulate Win11 environment to see if that’s the case
Can you please share the console application where you managed to reproduce the exception?