While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment



# Reply

Great work!

Only one issue: the GetPdfPageCount() method does not work with all pdf's - for example encrypted documents or pdf with document level attachments. I used iTextSharp instead:

private int GetPdfPageCount(string fileName)
    iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(fileName);
    return pdfReader.NumberOfPages;

Richard Moss

# Reply

Thanks for the comments! As I recall (I haven't touched this code for a great while now), I took that particular code from elsewhere - I have no knowledge of the PDF format myself so wasn't aware of encryption or otherwise. Thanks for pointing this out though! I do use iTextSharp in other projects though, I'll make sure to use that instead should I revisit this code down the line.

Thanks again; Richard Moss