Get the PDF output file information

You can get the information about the PDF output file using the GetViewInfo method that returns a ViewInfo object. The object contains the Pages collection that represents each Page of the document.

The following code snippet shows how to get the page count and the width and height of each document page:

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.ForPdfView();
    ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions);

    // Display page count.
    Console.WriteLine("Pages count: " + viewInfo.Pages.Count);

    // 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");
    }
}
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.ForPdfView()
            Dim viewInfo As ViewInfo = viewer.GetViewInfo(viewInfoOptions)
        
            ' Display page count.
            Console.WriteLine("Pages count: " & viewInfo.Pages.Count.ToString())
        
            ' 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

The following image shows a sample console output: