2.1 Continuous Scrolling Mode

Precautions

This new mode is only supported by the duraSign Pad 10.0 or similar ones. The feature was added with firmware version 7.09, so if your device has an older firmware version, you need to update it first (see /wiki/spaces/PUBS/pages/78872830). To check your firmware version, take a look at the lower right corner while the device is starting up. 

Description

The pad itself is requesting the needed document tiles (smaller parts of the document page) from the host application while the user is scrolling. The pad can store 1.5 rendered pages and needs to load further document parts on-the-fly. Therefor the application needs to satisfy these requests with new functionalities (e.g. a new EventHandler is required).

Implementation

Initialization

Add the callback of the OnDeviceCScrollingEventHandler to your application.

Delphi - Initialization
procedure TForm1.FormShow(Sender: TObject);
begin

  // this call is needed to use the possibility to view a document on the device's LCD
  SignApi.SignatureDevice := StepOverSignatureDevice1.DefaultInterface;
 
  // Continuous Scrolling Mode needs a callback routine for creating and transfering the requested tile to the pad
  StepOverSignatureDevice1.OnDeviceCScrollingEventHandler := OnDeviceCScrollingEventHandler;
 
end;
C# - Initialization
private void FormMain_Load(object sender, EventArgs e)
{
	//	make the Device and SignAPI familiar with each other
    SignAPIv4.SignatureDevice = (IStepOverSignatureDevice)SigDev.GetOcx();
	...			
    //  Events for ViewDocOnDevice button and StartSigning button
    SignAPIv4.OnLCDSignButton += new EventHandler(SignAPIv4_OnLCDSignButton);
	SigDev.OnDeviceButton += new AxStepOverSignatureDevice1.IStepOverSignatureDeviceEvents_OnDeviceButtonEventHandler(SigDev_OnDeviceButton);
	//	Add callback event for Continuous Scrolling Mode
    SigDev.OnDeviceCScrollingEventHandler += new AxStepOverSignatureDevice1.IStepOverSignatureDeviceEvents_OnDeviceCScrollingEventHandlerEventHandler(OnDeviceCScrollingEventHandler);
	...
	// Add the other event handlers, which are required for signing as well (OnReadHighResBitmap, OnGetAesKey, OnGetDeviceCertificate, OnGetSignedDocHash)
}

Event Handler

The OnDeviceCScrollingEventHandler is required for scrolling. It forwards the scrolling information to the SignAPI, which needs to react by sending a new part of the document to the device. 

Delphi - Event Handler
  TForm1 = class(TForm)
    ...
    StepOverSignatureDevice1: TStepOverSignatureDevice;
    ... 
    SignApi: TStepOverSignatureAPIv4;
    ...
    procedure StepOverSignatureAPI1Create(Sender: TObject);
    ...
    // Add ButtonEvent handler
    procedure StepOverSignatureDevice1DeviceButton(Sender: TObject; ButtonEvent: Integer);
    procedure SignApiLCDSignButton(Sender: TObject);
    ...
    // Also add the other Event handlers like ReadHighResBitmap, GetAesKey, GetDeviceCertificate, GetSignedDocHash which are necessary to add a signature to the PDF
    ...
  private
    { Private-Deklarationen }
    ...
    procedure OnDeviceCScrollingEventHandler(Sender:TObject; PadMode: Integer; SubMode: Integer; PenState: Integer; RequestedTileNo: Integer; WParam: Integer);

  public
    { Public-Deklarationen }
  end;

...

procedure TForm1.OnDeviceCScrollingEventHandler(Sender:TObject; PadMode: Integer; SubMode: Integer; PenState: Integer; RequestedTileNo: Integer; WParam: Integer);
begin
    SignApi.OnDeviceCScrollingHandler(PadMode, SubMode, PenState, RequestedTileNo, WParam);
end;

 
procedure TForm1.StepOverSignatureDevice1DeviceButton(Sender: TObject; ButtonEvent: Integer);
begin
  // setting this API's property will enable button navigation in document viewing mode (page up/down, zoom)
  SignApi.OnDeviceLCDButtonHandler(ButtonEvent);
  
  // Add more logic to handle the signature conformation (OK/Repeat/Cancel buttons)
  ...
end;
...
procedure TForm1.SignApiLCDSignButton(Sender: TObject);
begin
  Button2Click(nil); // do whatever you need to start a signature
end;
C# - Event Handler
private void OnDeviceCScrollingEventHandler(object sender, IStepOverSignatureDeviceEvents_OnDeviceCScrollingEventHandlerEvent e)
{
	SignAPIv4.OnDeviceCScrollingHandler(e.padMode, e.subMode, e.penState, e.requstedTileNo, e.wParam);
}

private void SigDev_OnDeviceButton(object sender, AxStepOverSignatureDevice1.IStepOverSignatureDeviceEvents_OnDeviceButtonEvent e)
{
	// Forward the Button Events to the SignAPI; this is required that the SignAPI can response to Page Up/Down and Zoom +/- buttons while in document viewing mode.
	SignAPIv4.OnDeviceLCDButtonHandler(e.buttonEvent);
}

void axSignAPIv4_OnLCDSignButton(object sender, EventArgs e)
{
	// Start Signing
	SigDev.startCapture("", true, true, true, true, ref padSettings);
}

Start of document viewing

If you want to use the Continuous Scrolling Mode you need to enable it with SetGSValueBool, otherwise the old Document Viewing Mode is used. So far, the Continuous Scrolling Mode only works with 0° pad rotation (landscape for right handed persons) and if the pad is in any other rotation, it will be automatically set to 0° degrees. You also need to set the SignAPI language, as this will be used for the text of the start signing button.

Delphi - Start of document viewing
// this starts the document view mode on device

procedure TForm1.viewDocBtnClick(Sender: TObject);
begin
  SignApi.setLanguage('D'); // D = German language, options are GB,F,ES,PL,NL,D
  SignApi.SetGSValueBool('UseCSMode',True); // use CSMode if possible
  SignApi.ViewDocOnDeviceEnableRotationButton(False); // (currently) no rotation possible in CS mode
  SignApi.ViewDocOnDevice(1, True); // start on page 1 with the Sign Now button active
end;
C# - Start of document viewing
//	set the language and enable the Continuous Scrolling Mode 
SignAPIv4.SetLanguage("D");
SignAPIv4.SetGSValueBool("UseCSMode", true);
//	start Document Viewing (with Continuous Scrolling), you set starting page and enable/disable the start signing button, which allows the user to start the signing mode
SignAPIv4.ViewDocOnDevice(1, true);