Recently migrated from .net core 6 to 8.
Also migrated the Spire.PDF to 10.2 from 8.6
After migration observe that memory conception on the deployed server is very high, many of the time getting OutOfMemory Exception from the Code. Basically I read the template PDF file and get the fields from FieldsWidgets and update the values, then save the file as PDF.
Given the code snippet for reference
string sourceTemplate = Path.Combine(Environment.CurrentDirectory, @"Templates\", templateFile);
var doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(sourceTemplate);
PdfFormWidget formWidget = doc.Form as PdfFormWidget;
var fields = formWidget.FieldsWidget;
if (fields != null)
{
fields.SetValue("Customer first name", order.CustomerFirstName);
fields.SetValue("Customer last name", order.CustomerLastName);
}
doc.Form.IsFlatten = true;
using (MemoryStream stream = new MemoryStream())
{
doc.SaveToStream(stream);
doc.SaveToFile(tempFileName);
}
Do you have any input on this?