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:
usingSystem;usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;usingGroupDocs.Viewer.Results;// ...using(Viewerviewer=newViewer("sample.pdf")){// Get file information.ViewInfoOptionsviewInfoOptions=ViewInfoOptions.ForPdfView();ViewInfoviewInfo=viewer.GetViewInfo(viewInfoOptions);// Display page count.Console.WriteLine("Pages count: "+viewInfo.Pages.Count);// Display width and height of each page.foreach(PagepageinviewInfo.Pages){Console.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels");Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels");}}
ImportsSystemImportsGroupDocs.ViewerImportsGroupDocs.Viewer.OptionsImportsGroupDocs.Viewer.Results' ...
ModuleProgramSubMain(argsAsString())UsingviewerAsViewer=NewViewer("sample.pdf")' Get file information.
DimviewInfoOptionsAsViewInfoOptions=ViewInfoOptions.ForPdfView()DimviewInfoAsViewInfo=viewer.GetViewInfo(viewInfoOptions)' Display page count.
Console.WriteLine("Pages count: "&viewInfo.Pages.Count.ToString())' Display width and height of each page.
ForEachpageAsPageInviewInfo.PagesConsole.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels")Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels")NextEndUsingEndSubEndModule
sample.pdf is the sample file used in this example. Click here to download it.