Set View Preferences for PDF – C#

For having a best reading effect, people may set View preference for a document. In this post, I will show a method to set PDF view preference with C#.

In a PDF document, we can adjust view mode according to our requirements. There are several options in View item. The frequently used options include page display, full mode, hide or unhide menu bar and toolbar.

In this example, I will set if hiding menu bar and tool bar and page layout. After running, we can find that the menu bar and tool bar are disappeared and two pages are shown together as two columns.

The following steps guide us to realize settings.

  1. Load the PDF document from computer which we want to set view preference.
  2. Set view preference, including if display title, hide menu bar and tool bar, page layout.
  3. Save and Launch file.

Main Coding:

using System;

using Spire.Pdf;

namespace ViewPreference


    class View


        static void Main(string[] args)



            PdfDocument doc = new PdfDocument();;

            doc.LoadFromFile(@”D:\work\My Documents\Breaking the Ice with Qawah.pdf”);



            doc.ViewerPreferences.CenterWindow = true;

            doc.ViewerPreferences.DisplayTitle = false;

            doc.ViewerPreferences.FitWindow = false;

            doc.ViewerPreferences.HideMenubar = true;

            doc.ViewerPreferences.HideToolbar = true;

            doc.ViewerPreferences.PageLayout = PdfPageLayout.TwoPageLeft;











Note: I use Spire.PDF in this example, so if you want to use the above code, please add its dll file as reference.

Also, if you want to set full screen mode for PDF document, please use the following sentence.

            doc.ViewerPreferences.PageMode = PdfPageMode.FullScreen;

Result Shown by Following:


Click Here to Learn more about Spire.PDF

Click Here to Download Spire.PDF


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s