Product: PDFTron.NETCore.Windows.x64
Product Version: 9.2.0
Please give a brief summary of your issue:
(Think of this as an email subject)
Bad allocation when using pdftron in Azure
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
I have taken some code to test pdf creation from a template (PDFTron) and everything works fine locally. When I push the code to an App Service running in Azure I get the following exception
pdftron.Common.PDFNetException
Exception:
Message: document layout failed: bad allocation
Conditional expression:
Version : 9.2.0-91be0af529
Platform : Windows
Architecture : AMD64
Filename : FlowToPDFConversion.cpp
Function : PDF::DocxConversion::Convert()
Linenumber : 189
As it says bad allocation I was suspecting a memory issue, but I checked the App Service and there is plenty of memory available and when I run the code locally I see no issues in huge memory usage either.
This is the code I’m using:
var templateParams = new
{
Title = $"Hello world"
};
using var doc = new PDFDoc();
var templateOptions = new OfficeToPDFOptions();
templateOptions.SetTemplateParamsJson(JsonSerializer.Serialize(templateParams));
pdftron.PDF.Convert.OfficeToPDF(doc, "DownloadTemplate.docx", templateOptions);
doc.Save(outputStream, pdftron.SDF.SDFDoc.SaveOptions.e_linearized);
Can someone help me figure out what’s going wrong?