Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Feb 08, 2022 8:47 pm

Seems like a very simple question - but how does one get the page number of the page you are iterating? `page.Section.PageNumber = null`. Is ordering guaranteed if I just track it myself?

Code: Select all
var pageNumber = 0;
foreach (PdfPageBase page in doc.Pages)
{
  pageNumber++;
  var text = page.ExtractText(textOptions);
}

replaysMike
 
Posts: 14
Joined: Tue Feb 08, 2022 8:43 pm

Wed Feb 09, 2022 7:29 am

Hello,

Thanks for your inquiry!
Kindly note that the "page.Section.PageNumber" method is obsoleted in our current versions and it can not return the correct result.
The page ordering is guaranteed when you track it by you used code, just go ahead. If there is any other question, please feel free to write back.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 762
Joined: Mon Dec 27, 2021 2:23 am

Wed Feb 09, 2022 10:16 pm

This works for me William, thanks.

replaysMike
 
Posts: 14
Joined: Tue Feb 08, 2022 8:43 pm

Thu Feb 10, 2022 5:55 am

Hello,

Thanks for your feedback!
Glad to hear that! If you encounter any issues related to our products in the future, just feel free to contact us.
Wish you all the best!

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 762
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDF