How to: Get Image Page Count in .NET C#

How to get image page count in .NET C#

private int GetTotalpages(string filePath)
{
int pageCount = 0;
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
using (Image temp = Image.FromStream(fs))
{
pageCount = temp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
}
}

return pageCount;
}

KyoungSu Do
Software Developer
ImageSource, Inc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s