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
The following image shows a sample console output:
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.