Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim PreferenceFound As Boolean
PreferenceFound = gdpicturePDF.GetViewerPreference(PdfViewerPreference.PdfViewerPreferenceCenterWindow)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
'The required preference is defined for the currently loaded PDF document.
If PreferenceFound = True Then
'The preference is enabled.
MessageBox.Show("The position of the document's window is set to be in the center of the screen.", "Example: GetViewerPreference")
Else
'The preference is disabled.
MessageBox.Show("The position of the document's window is set not to be in the center of the screen.", "Example: GetViewerPreference")
End If
Else
MessageBox.Show("The GetViewerPreference() method has failed with the status: " + status.ToString(), "Example: GetViewerPreference")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetViewerPreference")
End If
gdpicturePDF.Dispose()
'You can do the same for other viewer preferences:
'PdfViewerPreference.PdfViewerPreferenceHideToolbar specifies that the viewer application's tool bars will be hidden when the document is active.
'PdfViewerPreference.PdfViewerPreferenceHideMenubar specifies that the viewer application's menu bar will be hidden when the document is active.
'PdfViewerPreference.PdfViewerPreferenceHideWindowUI specifies that the user interface elements in the document's window (such as scroll bars and navigation controls) will be hidden, leaving only the document's content displayed.
'PdfViewerPreference.PdfViewerPreferenceFitWindow specifies that the document's window will be resized to fit the size of the first displayed page.
'PdfViewerPreference.PdfViewerPreferenceDisplayDocTitle specifies that the window's title bar should display the document title taken from the document information dictionary.
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
bool PreferenceFound = gdpicturePDF.GetViewerPreference(PdfViewerPreference.PdfViewerPreferenceCenterWindow);
status = gdpicturePDF.GetStat();
//The required preference is defined for the currently loaded PDF document.
if (status == GdPictureStatus.OK)
{
if (PreferenceFound)
{
//The preference is enabled.
MessageBox.Show("The position of the document's window is set to be in the center of the screen.", "Example: GetViewerPreference");
}
else
{
//The preference is disabled.
MessageBox.Show("The position of the document's window is set not to be in the center of the screen.", "Example: GetViewerPreference");
}
}
else
{
MessageBox.Show("The GetViewerPreference() method has failed with the status: " + status.ToString(), "Example: GetViewerPreference");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: GetViewerPreference");
}
gdpicturePDF.Dispose();
//You can do the same for other viewer preferences:
//PdfViewerPreference.PdfViewerPreferenceHideToolbar specifies that the viewer application's tool bars will be hidden when the document is active.
//PdfViewerPreference.PdfViewerPreferenceHideMenubar specifies that the viewer application's menu bar will be hidden when the document is active.
//PdfViewerPreference.PdfViewerPreferenceHideWindowUI specifies that the user interface elements in the document's window (such as scroll bars and navigation controls) will be hidden, leaving only the document's content displayed.
//PdfViewerPreference.PdfViewerPreferenceFitWindow specifies that the document's window will be resized to fit the size of the first displayed page.
//PdfViewerPreference.PdfViewerPreferenceDisplayDocTitle specifies that the window's title bar should display the document title taken from the document information dictionary.