I have the following code, the objective is to open a file pdf
, calculate the hash
of it and keep the file in memory (approximately 20 seconds) to later sign it and save it. What happens, a pdf
of 90mb is loaded and when you open it and keep it in memory the consumption goes up to 1.2gb :
entitySing.output = new MemoryStream();
entitySing.sap = PdfStamper.CreateSignature(new PdfReader(entitySing.inputBase64File),
entitySing.output, 'entitySing.output = new MemoryStream();
entitySing.sap = PdfStamper.CreateSignature(new PdfReader(entitySing.inputBase64File),
entitySing.output, '%pre%', null, true).SignatureAppearance;
entitySing.sap.SignatureGraphic = iTextSharp.text.Image.GetInstance(FileProcess.CompanyStampImageByte());
if (entitySing.digitalSign.Visible)
entitySing.sap.SetVisibleSignature(new iTextSharp.text.Rectangle(float.Parse(entitySing.llx),
float.Parse(entitySing.lly), float.Parse(entitySing.urx),
float.Parse(entitySing.ury)), 1, null);
', null, true).SignatureAppearance;
entitySing.sap.SignatureGraphic = iTextSharp.text.Image.GetInstance(FileProcess.CompanyStampImageByte());
if (entitySing.digitalSign.Visible)
entitySing.sap.SetVisibleSignature(new iTextSharp.text.Rectangle(float.Parse(entitySing.llx),
float.Parse(entitySing.lly), float.Parse(entitySing.urx),
float.Parse(entitySing.ury)), 1, null);
The above is only the part of the pdfreader
and pdfstamper
that according to the tracking performed are the objects that are carrying the memory.