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 (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");

The following image shows a sample console output: