GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / GetViewerPageMode Method
Example





In This Topic
GetViewerPageMode Method (GdPicturePDF)
In This Topic
Returns the document's page mode setting, specifying how the document should be displayed when opened in Adobe Reader or Acrobat viewer.
Syntax
'Declaration
 
Public Function GetViewerPageMode() As PdfViewerPageMode
public PdfViewerPageMode GetViewerPageMode()
public function GetViewerPageMode(): PdfViewerPageMode; 
public function GetViewerPageMode() : PdfViewerPageMode;
public: PdfViewerPageMode GetViewerPageMode(); 
public:
PdfViewerPageMode GetViewerPageMode(); 

Return Value

A member of the PdfViewerPageMode enumeration. The default value is PdfViewerPageMode.PdfViewerPageModeUseNone.

The GetStat method can be subsequently used to determine if this method has been successful.

Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Example
How to find out the way your document will display on opening.
Dim caption As String = "Example: GetViewerPageMode"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
   Dim oPdfViewerPageMode As PdfViewerPageMode = gdpicturePDF.GetViewerPageMode()
   status = gdpicturePDF.GetStat()
   If status = GdPictureStatus.OK Then
        Select Case oPdfViewerPageMode
        Case PdfViewerPageMode.PdfViewerPageModeUseNone
        MessageBox.Show("Neither document outline nor thumbnail images are visible.", caption)
        Case PdfViewerPageMode.PdfViewerPageModeUseOutlines
        MessageBox.Show("Document outline is visible.", caption)
        Case PdfViewerPageMode.PdfViewerPageModeUseThumbs
        MessageBox.Show("Thumbnail images are visible.", caption)
        Case PdfViewerPageMode.PdfViewerPageModeFullScreen
        MessageBox.Show("Full-screen mode, with no menu bar, window controls, or any other window is visible.", caption)
        Case PdfViewerPageMode.PdfViewerPageModeUseOC
        MessageBox.Show("(PDF 1.5) Optional content group panel is visible.", caption)
        Case PdfViewerPageMode.PdfViewerPageModeUseAttachments
        MessageBox.Show("(PDF 1.6) Attachments panel is visible.", caption)
        Case Else
        MessageBox.Show("Invalid value has been returned.", caption)
        End Select
   Else
        MessageBox.Show("The GetViewerPageMode() method has failed.", caption)
   End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetViewerPageMode";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    PdfViewerPageMode oPdfViewerPageMode = gdpicturePDF.GetViewerPageMode();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        switch (oPdfViewerPageMode)
        {
            case PdfViewerPageMode.PdfViewerPageModeUseNone:
                MessageBox.Show("Neither document outline nor thumbnail images are visible.", caption);
                break;
            case PdfViewerPageMode.PdfViewerPageModeUseOutlines:
                MessageBox.Show("Document outline is visible.", caption);
                break;
            case PdfViewerPageMode.PdfViewerPageModeUseThumbs:
                MessageBox.Show("Thumbnail images are visible.", caption);
                break;
            case PdfViewerPageMode.PdfViewerPageModeFullScreen:
                MessageBox.Show("Full-screen mode, with no menu bar, window controls, or any other window is visible.", caption);
                break;
            case PdfViewerPageMode.PdfViewerPageModeUseOC:
                MessageBox.Show("(PDF 1.5) Optional content group panel is visible.", caption);
                break;
            case PdfViewerPageMode.PdfViewerPageModeUseAttachments:
                MessageBox.Show("(PDF 1.6) Attachments panel is visible.", caption);
                break;
            default:
                MessageBox.Show("Invalid value has been returned.", caption);
                break;
        }
    }
    else
    {
        MessageBox.Show("The GetViewerPageMode() method has failed.", caption);
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();
See Also