Method SetDocumentViewing
SetDocumentViewing(Bitmap, Int32, Int32)
Makes the device show a page of a document.
Declaration
Error SetDocumentViewing(Bitmap image, int pageNumber, int numberOfPages)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | image | The page. |
System.Int32 | pageNumber | The page number. |
System.Int32 | numberOfPages | The number of pages of the document. |
Returns
Type | Description |
---|---|
Error | Error |
Remarks
The device indicates the page number in the format (pageNumber/numberOfPages).
Examples
The following example shows a document viewing for a document with two pages. First, the button bar is configured such that only the next button is visible and enabled. An event handler is assigned to the ButtonEvent that loads the second document page if the next button is pressed. Then, the first page is loaded and the thread waits for 11s for someone to press the next button on the device.
C#
Bitmap page1 = new Bitmap("FirstPage.png");
Bitmap page2 = new Bitmap("SecondPage.png");
Error ShowAndEnableNextButtonOnlyInDocView()
{
Error r = driver.GetButtonConfig(out ButtonBar buttonBar, ButtonBarMode.DocView);
foreach (ButtonKind buttonKind in buttonBar.Configs.Keys)
{
if (ButtonKind.Next == buttonKind)
{
buttonBar.Configs[buttonKind].Enabled = true;
buttonBar.Configs[buttonKind].Visible = true;
}
else
{
buttonBar.Configs[buttonKind].Enabled = false;
buttonBar.Configs[buttonKind].Visible = false;
}
}
r = driver.SetButtonConfig(buttonBar);
return r;
}
void LoadSecondPageIfNextPressed(object sender, ButtonEventArgs e)
{
if (ButtonKind.Next == e.ButtonKind)
Task.Factory.StartNew(() =>
{
Console.WriteLine("Loading the second page.");
driver.SetDocumentViewing(page2, 2, 2);
});
}
Error r = ShowAndEnableNextButtonOnlyInDocView();
driver.ButtonEvent += LoadSecondPageIfNextPressed;
// show first page
r = driver.SetDocumentViewing(page1, 1, 2);
// click the next button
Thread.Sleep(11000);
A similar program with the difference that the button event handler responds to any button.
VB.NET
Sub DocumentViewing()
Dim page1 As Bitmap = New Bitmap("FirstPage.bmp")
Dim page2 As Bitmap = New Bitmap("SecondPage.bmp")
' show first page
Dim r As Sig.DeviceAPI.Error = driver.SetDocumentViewing(page1, 1, 2)
' enable the next button which is handled by the Sub LoadSecondPage
Dim buttonBar As ButtonBar
r = driver.GetButtonConfig(buttonBar)
Dim buttonKind As ButtonKind = ButtonKind.Next
Dim buttonConfig As ButtonConfig = buttonBar.Configs(buttonKind)
buttonConfig.Visible = True
buttonConfig.Enabled = True
buttonBar.Configs.Clear()
buttonBar.Configs.Add(buttonKind, buttonConfig)
r = driver.SetButtonConfig(buttonBar)
' click a button
Thread.Sleep(11000)
End Sub
Sub LoadSecondPage(sender As Object, e As ButtonEventArgs) Handles driver.ButtonEvent
Task.Factory.StartNew(Sub()
Console.WriteLine("Loading the second page.")
driver.SetDocumentViewing(page2, 2, 2)
End Sub)
End Sub
SetDocumentViewing(String, Int32, Int32)
Shows an image loaded from a file on the device.
Declaration
Error SetDocumentViewing(string path, int pageNumber, int numberOfPages)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The image file to read from. Supported formats include bmp, png, jpeg. |
System.Int32 | pageNumber | The page number. |
System.Int32 | numberOfPages | The number of pages of the document. |
Returns
Type | Description |
---|---|
Error | Error |
Remarks
Similar to SetDocumentViewing(Bitmap, Int32, Int32) with the difference that the image is loaded from the path given.