Get Viewer Preference of PDF File

Get Viewer Preference of an existing PDF File

ViewerPreference class represents display modes of PDF files; for example, positioning the document window in the center of the screen, hiding viewer application’s menu bar etc.

In order to read the settings we use GetViewerPreference class. This method returns a variable where all settings are saved.

      public static void GetViewerPreference()
        {
            var document = new Document(_dataDir + "PdfContentEditorDemo_SetViewerPreference.pdf");
            PdfContentEditor editor = new PdfContentEditor(document);

            // Change Viewer Preferences
            var preferences = editor.GetViewerPreference();
            if ((preferences & ViewerPreference.CenterWindow) != 0)
                Console.WriteLine("CenterWindow");
            if ((preferences & ViewerPreference.HideMenubar) != 0)
                Console.WriteLine("Menu bar hided");
            if ((preferences & ViewerPreference.PageModeFullScreen) != 0)
                Console.WriteLine("Page Mode Full Screen");
        }