# Get the width and height of the document pages This article explains how to get the width and height of the document pages using .NET / C# with GroupDocs.Viewer for .NET. You can get the width and height of each document page using the [GetViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/getviewinfo) method that returns a [ViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo) object. The object contains the [Pages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo/pages/) collection that represents each [Page](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/page/) of the document. The following code snippet shows how to get the width and height of each document page: {{< tabs "get-page-width-and-height">}} {{< tab "C#" >}} ```csharp using System; using GroupDocs.Viewer; using GroupDocs.Viewer.Options; using GroupDocs.Viewer.Results; // ... using (Viewer viewer = new Viewer("sample.pdf")) { // Get file information. ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView(); ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions); // Display width and height of each page. foreach (Page page in viewInfo.Pages) { Console.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels"); Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels"); } } ``` {{< /tab >}} {{< tab "VB.NET">}} ```vb Imports System Imports GroupDocs.Viewer Imports GroupDocs.Viewer.Options Imports GroupDocs.Viewer.Results ' ... Module Program Sub Main(args As String()) Using viewer As Viewer = New Viewer("sample.pdf") ' Get file information. Dim viewInfoOptions As ViewInfoOptions = ViewInfoOptions.ForHtmlView() Dim viewInfo As ViewInfo = viewer.GetViewInfo(viewInfoOptions) ' Display width and height of each page. For Each page As Page In viewInfo.Pages Console.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels") Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels") Next End Using End Sub End Module ``` {{< /tab >}} {{< tab "sample.pdf" >}} {{< tab-text >}} `sample.pdf` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/net/_sample_files/developer-guide/retrieving-document-information/how-to-get-page-width-and-height/sample.pdf) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "get-page-width-and-height.txt" >}} ```text Page: 1; Width: 595, pixels Page: 1; Height: 842, pixels Page: 2; Width: 595, pixels Page: 2; Height: 842, pixels Page: 3; Width: 595, pixels Page: 3; Height: 842, pixels Page: 4; Width: 595, pixels Page: 4; Height: 842, pixels ``` [Download full output](https://docs.groupdocs.com/viewer/net/_output_files/developer-guide/retrieving-document-information/how-to-get-page-width-and-height/GetPageWidthAndHeight/get-page-width-and-height.txt) {{< /tab >}} {{< /tabs >}}