We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfFileStamp.Document and PdfContentEditor.Document removed from API

Now that PdfFileStamp.Document and PdfContentEditor.Document have been removed from the Aspose.Pdf API, if I want an Aspose.Pdf.Document instance, I have to open the document twice.

For example, I used to do this:

PdfContentEditor pdfContentEditor = new PdfContentEditor();
int pageCount = pdfContentEditor.Document.Pages.Count;

But now I have to do this:

int pageCount;
PdfContentEditor pdfContentEditor = new PdfContentEditor();

using (var pdf = new Aspose.Pdf.Document(pdfFilePath))
pageCount = pdf.Pages.Count;

I have found that this reduces performance by about 30%.

Is there an alternative solution that doesn’t affect performance?


Hi Reuben,

Thanks for using our products.

I have observed the same issue in latest release version of Aspose.Pdf for .NET. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34322. We
will investigate this issue in details and will keep you updated on the status
of a correction. We
apologize for your inconvenience.

Besides this, you may consider using the approach to save the file manipulated with PdfFileStamp and PdfContentEditor objects, save them in Stream object and then initialize Document object using the same steam. However if you simply need to get the page count information, you may try using NumberOfPages property of PdfFileInfo class.

The issues you have found earlier (filed as PDFNEWNET-34322) have been fixed in Aspose.Pdf for .NET 7.5.0.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.