I use the below code to set license and use pdf document. In window exe
I use aspose pdf dll 25.1.0.0 vserion
Dim PDFLicense As Aspose.Pdf.License = New Aspose.Pdf.License()
PDFLicense.SetLicense(LicensePath)
Dim options As Aspose.Pdf.XpsLoadOptions = New Aspose.Pdf.XpsLoadOptions()
Dim document As Aspose.Pdf.Document = New Aspose.Pdf.Document(inputfile, options)
document.Save(outputfile)
It appears you are encountering an error while using Aspose.PDF version 25.1.0.0 with the provided code. The issue may be related to the file format of the input file or the way the XpsLoadOptions are being utilized.
Here are some steps to troubleshoot the problem:
Check Input File Format: Verify that the inputfile you are trying to load is indeed in XPS format. If it is not, you will need to use the appropriate load options for the actual file format.
Error Handling: Implement error handling to capture the specific exception being thrown. This can provide more insight into what is going wrong. For example:
Try
Dim document As Aspose.Pdf.Document = New Aspose.Pdf.Document(inputfile, options)
document.Save(outputfile)
Catch ex As Aspose.Pdf.PdfException
Console.WriteLine("PDF Exception: " & ex.Message)
Catch ex As Exception
Console.WriteLine("General Exception: " & ex.Message)
End Try
Update Aspose.PDF: If possible, consider updating to a newer version of Aspose.PDF, as there may have been bug fixes or improvements since version 25.1.0.0.
Consult Documentation: Review the official documentation for XpsLoadOptions and the Document class to ensure you are using them correctly.
If the issue persists, please provide the exact error message or exception details to assist in further diagnosing the problem.
We strongly recommend using the latest version of the API, as support is primarily provided for it. The latest version includes the most fixes and improvements. The issue you’re encountering in version 25.1 might be related to your specific environment or configuration. Please try creating a new standalone console application and test again. Additionally, consider changing the .NET Framework version. We hope this resolves the problem.
We have already responded to your similar question in our previous message. Please try to perform the suggested steps as we hope this will help in resolving your issue.
Please try to perform above steps to further check at your end. Also, try to change the API version (any older than 25.1) and see if license works with it or not.
Would you please share your license file with us in .zip format? Please share it via private message that you can send by clicking on username and pressing the Blue Message Button. We will further try to test the case in our environment and share our feedback with you.
Thanks for sharing the license file in the private message. We have tested your license file with 25.1 version of the API and could not replicate the issue in our environment. As requested before - could you please share a sample console application for our reference that can reproduce the same issue you have been facing? We will again try to replicate it and share our feedback accordingly.