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





In This Topic
GetViewerLayoutMode Method (GdPicturePDF)
In This Topic
Returns the document's layout mode setting, specifying the page layout to be used when the document is opened in Adobe Reader or Acrobat viewer.
Syntax
'Declaration
 
Public Function GetViewerLayoutMode() As PdfViewerLayoutMode
public PdfViewerLayoutMode GetViewerLayoutMode()
public function GetViewerLayoutMode(): PdfViewerLayoutMode; 
public function GetViewerLayoutMode() : PdfViewerLayoutMode;
public: PdfViewerLayoutMode GetViewerLayoutMode(); 
public:
PdfViewerLayoutMode GetViewerLayoutMode(); 

Return Value

A member of the PdfViewerLayoutMode enumeration. The default value is PdfViewerLayoutMode.PdfViewerLayoutModeSinglePage.

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 current page layout mode of the PDF document.
Dim caption As String = "Example: GetViewerLayoutMode"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim oLayoutMode As PdfViewerLayoutMode = gdpicturePDF.GetViewerLayoutMode()
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        Select Case oLayoutMode
        Case PdfViewerLayoutMode.PdfViewerLayoutModeSinglePage
        MessageBox.Show("This PDF displays one page at a time.", caption)
        Case PdfViewerLayoutMode.PdfViewerLayoutModeOneColumn
        MessageBox.Show("This PDF displays the pages in one column.", caption)
        Case PdfViewerLayoutMode.PdfViewerLayoutModeTwoColumnLeft
        MessageBox.Show("This PDF displays the pages in two columns, with odd-numbered pages on the left.", caption)
        Case PdfViewerLayoutMode.PdfViewerLayoutModeTwoColumnRight
        MessageBox.Show("This PDF displays the pages in two columns, with odd-numbered pages on the right.", caption)
        Case PdfViewerLayoutMode.PdfViewerLayoutModeTwoPageLeft
        MessageBox.Show("This PDF displays the pages two at a time, with odd-numbered pages on the left.", caption)
        Case PdfViewerLayoutMode.PdfViewerLayoutModeTwoPageRight
        MessageBox.Show("This PDF displays the pages two at a time, with odd-numbered pages on the right.", caption)
        Case Else
        MessageBox.Show("An invalid value has been returned.", caption)
        End Select
    Else
        MessageBox.Show("The GetViewerLayoutMode() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetViewerLayoutMode";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    PdfViewerLayoutMode oLayoutMode = gdpicturePDF.GetViewerLayoutMode();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        switch (oLayoutMode)
        {
            case PdfViewerLayoutMode.PdfViewerLayoutModeSinglePage:
                MessageBox.Show("This PDF displays one page at a time.", caption);
                break;
            case PdfViewerLayoutMode.PdfViewerLayoutModeOneColumn:
                MessageBox.Show("This PDF displays the pages in one column.", caption);
                break;
            case PdfViewerLayoutMode.PdfViewerLayoutModeTwoColumnLeft:
                MessageBox.Show("This PDF displays the pages in two columns, with odd-numbered pages on the left.", caption);
                break;
            case PdfViewerLayoutMode.PdfViewerLayoutModeTwoColumnRight:
                MessageBox.Show("This PDF displays the pages in two columns, with odd-numbered pages on the right.", caption);
                break;
            case PdfViewerLayoutMode.PdfViewerLayoutModeTwoPageLeft:
                MessageBox.Show("This PDF displays the pages two at a time, with odd-numbered pages on the left.", caption);
                break;
            case PdfViewerLayoutMode.PdfViewerLayoutModeTwoPageRight:
                MessageBox.Show("This PDF displays the pages two at a time, with odd-numbered pages on the right.", caption);
                break;
            default:
                MessageBox.Show("An invalid value has been returned.", caption);
                break;
        }
    }
    else
    {
        MessageBox.Show("The GetViewerLayoutMode() method has failed with the status: " + status.ToString(), caption);
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();
See Also