How To Specify PDF Viewer Application Preferences

This sample shows how to specify a PDF viewer application preferences using PDFDocument.ViewerPreferences property.
A PDF viewer application preferences specify the way the document is to be displayed on the screen.

There are the following supported viewer preferences:

  1. HideToolbar – gets or sets a value indicating whether to hide the viewer applications toolbars when.
  2. HideMenubar – gets or sets a value indicating whether to hide the viewer applications menu bar when.
  3. HideWindowUI – gets or sets a value indicating whether to hide user interface elements in the documents window (such as scroll bars and navigation controls), leaving only the document’s contents displayed.
  4. FitWindow – gets or sets a value indicating whether to resize the document’s window to fit.
  5. CenterWindow – gets or sets a value indicating whether to position the document’s window in.
  6. DisplayDocumentTitle – gets or sets a value indicating whether the window’s title bar should display.
  7. FullScreenPageMode – gets or sets how to display the document on exiting full-screen mode.
  8. Direction – gets or sets the predominant reading order for text.

 

using PDFMosaic;
using System;

namespace ViewerPreferences
{
    class ViewerPreferences
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            document.Pages.Add(new PDFPage(PDFPaperFormat.A4));

            document.ViewerPreferences.CenterWindow = true;
            document.ViewerPreferences.FitWindow = true;
            document.ViewerPreferences.HideMenubar = true;
            document.ViewerPreferences.HideToolbar = true;
            document.ViewerPreferences.HideWindowUI = true;

            document.Save("ViewerPreferences.pdf", true);
        }
    }
}