sungaila / PDFtoImage

A .NET library to render PDF files into images.
https://www.sungaila.de/PDFtoImage/
MIT License
144 stars 14 forks source link

How to get the total number of pages of the PDF file? #51

Closed Auto72 closed 7 months ago

Auto72 commented 7 months ago

Question

How to get the total number of pages of the PDF file?

sungaila commented 7 months ago

Hi @Auto72, you can do that by calling PDFtoImage.Conversion.GetPageCount.

using var fileStream = new FileStream(@"C:\YourPdfFile.pdf", FileMode.Open, FileAccess.Read);
var count = PDFtoImage.Conversion.GetPageCount(fileStream);