Hello Aspose Team,
We have licensed Aspose.pdf and Aspose.words.
At local machine - When I run the application at local and then able to convert xps and oxps file into pdf. But When we deployed our git project into AWS (lambda on AWS and in a Linux container image) then it is failing while converting the xps or oxps fil into pdf.
Getting following issue - When trying to convert xps or oxps file into pdf.
Error (XPS file conversion to pdf is failed and throwing an error):
“Error Log FunctionHandler Exception:[System.AggregateException: One or more errors occurred. (Supplied XPS file or stream is corrupt and cannot be parsed!) —> System.IO.FileLoadException: Supplied XPS file or stream is corrupt and cannot be parsed!”
Note: This is implemented at .Net Core with AWS Lambda.
Via Nuget Package Manager console installed - Aspose.PDF version 23.5.0
And also installed Aspose.words 21.11.0
At this .net core application lambda - We are using both Aspose words and pdf licensed libraries.
Also included both .lic files
Aspose.PDF.NET.lic
aspose.words.net.lic
At a class file - Constructor set license
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(@"aspose.words.net.lic");
Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
pdflicense.SetLicense(@"Aspose.PDF.NET.lic");
Technical Details:
Failing at this line of code document.Save(stream, Aspose.Pdf.SaveFormat.Pdf);
This is code block
var document = new Aspose.Pdf.Document(fileStream, new Aspose.Pdf.XpsLoadOptions());
using (MemoryStream stream = new MemoryStream())
{
document.Save(stream, Aspose.Pdf.SaveFormat.Pdf);
LoggerService.Log($"Start Save the file to pdf [{filePath}]");
var status = false;
try
{
// Place the pdf file at AWS S3 bucket
PutObjectRequest request = new PutObjectRequest()
{
AutoCloseStream = true,
BucketName = bucketName,
Key = key,
InputStream = stream,
ContentType = "application/pdf"
};
var response = await _s3Client.PutObjectAsync(request);
status = (response.HttpStatusCode == HttpStatusCode.OK);
}
finally
{
if (stream != null)
{
stream.Close();
stream.Dispose();
}
}
}