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





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

Parameters

PageMode
A member of the PdfViewerPageMode 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 viewer page mode to display the PDF document in full-screen mode on opening.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    status = gdpicturePDF.SetViewerPageMode(PdfViewerPageMode.PdfViewerPageModeFullScreen)
    If status = GdPictureStatus.OK Then
        If gdpicturePDF.SaveToFile("test_SetViewerPageMode_func.pdf", False) = GdPictureStatus.OK Then
            MessageBox.Show("The viewer page mode has been set successfully.", "Example: SetViewerPageMode")
        End If
    Else
        MessageBox.Show("The SetViewerPageMode() method has failed with the status: " + status.ToString(), "Example: SetViewerPageMode")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: SetViewerPageMode")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    status = gdpicturePDF.SetViewerPageMode(PdfViewerPageMode.PdfViewerPageModeFullScreen);
    if (status == GdPictureStatus.OK)
    {
        if (gdpicturePDF.SaveToFile("test_SetViewerPageMode_func.pdf", false) == GdPictureStatus.OK)
            MessageBox.Show("The viewer page mode has been set successfully.", "Example: SetViewerPageMode");
    }
    else
    {
        MessageBox.Show("The SetViewerPageMode() method has failed with the status: " + status.ToString(), "Example: SetViewerPageMode");
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", "Example: SetViewerPageMode");
}
gdpicturePDF.Dispose();
See Also