GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / SetViewerLayoutMode Method
A member of the PdfViewerLayoutMode enumeration. Set this parameter according to your preference.
Example





In This Topic
SetViewerLayoutMode Method (GdPicturePDF)
In This Topic
Sets 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 SetViewerLayoutMode( _
   ByVal LayoutMode As PdfViewerLayoutMode _
) As GdPictureStatus
public GdPictureStatus SetViewerLayoutMode( 
   PdfViewerLayoutMode LayoutMode
)
public function SetViewerLayoutMode( 
    LayoutMode: PdfViewerLayoutMode
): GdPictureStatus; 
public function SetViewerLayoutMode( 
   LayoutMode : PdfViewerLayoutMode
) : GdPictureStatus;
public: GdPictureStatus SetViewerLayoutMode( 
   PdfViewerLayoutMode LayoutMode
) 
public:
GdPictureStatus SetViewerLayoutMode( 
   PdfViewerLayoutMode LayoutMode
) 

Parameters

LayoutMode
A member of the PdfViewerLayoutMode enumeration. Set this parameter according to your preference.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to set the PDF document's page layout mode to display a single page at a time.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    status = gdpicturePDF.SetViewerLayoutMode(PdfViewerLayoutMode.PdfViewerLayoutModeSinglePage)
    If status = GdPictureStatus.OK Then
        If gdpicturePDF.SaveToFile("test_SetViewerLayoutMode_func.pdf", False) = GdPictureStatus.OK Then
            MessageBox.Show("The page layout mode has been set successfully.", "Example: SetViewerLayoutMode")
        End If
    Else
        MessageBox.Show("The SetViewerLayoutMode() method has failed with the status: " + status.ToString(), "Example: SetViewerLayoutMode")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: SetViewerLayoutMode")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    status = gdpicturePDF.SetViewerLayoutMode(PdfViewerLayoutMode.PdfViewerLayoutModeSinglePage);
    if (status == GdPictureStatus.OK)
    {
        if (gdpicturePDF.SaveToFile("test_SetViewerLayoutMode_func.pdf", false) == GdPictureStatus.OK)
            MessageBox.Show("The page layout mode has been set successfully.", "Example: SetViewerLayoutMode");
    }
    else
    {
        MessageBox.Show("The SetViewerLayoutMode() method has failed with the status: " + status.ToString(), "Example: SetViewerLayoutMode");
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", "Example: SetViewerLayoutMode");
}
gdpicturePDF.Dispose();
See Also