Saving a ~600 page pdf is too slow

I have a pdf file that has 624 pages (~32mb). I searched and redacted text from the document without any problem but after that when I wanted to generate an output file it was so slow that I had to interrupt the process after 20 minutes.

Is this normal that saving a 600-page document is taking that much time?
I will send you the file if it is necessary.

Aspose.PDF 20.8.0 version, .NETStandard 2.1

Code snippet:

foreach (Page actualPage in doc.Pages)
{
    TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Zimmer")
	{
    	TextSearchOptions = { IsRegularExpressionUsed = true }
    };
    actualPage.Accept(textFragmentAbsorber);

	foreach (var textFragment in textFragmentAbsorber.TextFragments)
	{
    	Console.WriteLine(textFragment.Text);
		var annot = new RedactionAnnotation(actualPage, textFragment.Rectangle) { FillColor = Color.Black};
		actualPage.Annotations.Add(annot);
	    annot.Redact();
	}
}
doc.Save("redacted.pdf");

Thanks,
Gabor

@erdeiga

The performance of the API depends upon the structure and complexity of the PDF document being processed. Would you kindly share a sample PDF document by uplaoding it to Dropbox or Google Drive. We will test the scenario in our environment and address it accordingly.

1 Like