How to check that PDF printing not allowed

Checking that sprinting not allowed

GroupDocs.Viewer provides additional information for PDF documents when calling GetViewInfo method. To retrieve view information for PDF document call GetViewInfo method and cast output result to PdfViewInfo type.

Following example demonstrates how to retrieve view information for PDF document.

            using (Viewer viewer = new Viewer("sample.pdf"))
            {
                ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView();
                PdfViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions) as PdfViewInfo;
 
                Console.WriteLine("Document type is: " + viewInfo.FileType);
                Console.WriteLine("Pages count: " + viewInfo.Pages.Count);
                Console.WriteLine("Printing allowed: " + viewInfo.PrintingAllowed);
            }
      

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.