System.OutOfMemoryException on pdfContentEditor


I am getting this exception on below line
pdfContentEditor.ReplaceText("/s/", 0, string.Concat("/s/ ", string.Concat(pckgAttyDetails.FirstName == null ? “” : string.Concat(pckgAttyDetails.FirstName + " "), pckgAttyDetails.MiddleName == null ? “” : string.Concat(pckgAttyDetails.MiddleName, " "), pckgAttyDetails.LastName == null ? “” : pckgAttyDetails.LastName)), textpropertyItalic);

Kindly Share your thoughts. we are using version 10.5…


Thanks for contacting support.

Would you please try using latest version of the API i.e. Aspose.PDF for .NET 19.1 along with DOM approach to replace text in PDF document. Please note that it is always recommended to use latest version because it contains more fixes and enhancements. In case you still face any issue, please share you sample PDF document with us. We will test the scenario in our environment and address it accordingly.

Hi Asad,

thanks for support but in this case PDF file is of 28 mb and contain 101 pages if we try to replace some character with name at once we gets the error but if i go through looping one by one page then it throws the error after 55 pages.

let me know how we can proceed on this?


Thanks for writing back.

In order to share further feedback about the issue you are facing, we have to test the scenario in our environment and we need you sample PDF document for that. Would you kindly share your PDF document with us so that we can test the scenario in our environment and address it accordingly. You may upload your document (if larger in size) to Dropbox or Google Drive and share the link with us.