Adding Multitouch Support to .NET PDF Viewer.

Q: I am developing a tablet implementation of our PDF software, which runs on a Windows 7 tablet. Our customer has requested some touch interface functionality, at this point specifically two finger scrolling and zooming. I do not see events for these inputs in the documentation for your .NET implementation . I am curious if I could use PDFNet .NET control to provide our customer with some touch functionality. Thank you for your support.

A:

The best option would be to use ‘pdftron.PDF.PDFViewCtrlWPF’ which is included as part of ‘PDFNet for .Net 4+’ (http://www.pdftron.com/pdfnet/downloads.html).

As a starting point, please take a look at PDFNet/Samples/PDFViewWPF sample.

WPF 4 includes support for touch events as described in the following article:

http://msdn.microsoft.com/en-us/library/ee649090.aspx

For example, a basic pinch to zoom could look as follows:

void PDFView_ManipulationDelta(object sender, ManipulationEventArgs e)

{

var deltaManipulation = e.DeltaManipulation;

//scaling

double dDelta = 0;

if (deltaManipulation.Scale.X > deltaManipulation.Scale.Y) dDelta = deltaManipulation.Scale.X;

else dDelta = deltaManipulation.Scale.Y;

double newZoom = this.GetZoom() * dDelta;

this.CurrentZoom = newZoom;

//scrolling

this.SetVScrollPos(this.GetVScrollPos() - deltaManipulation.Translation.Y * 1.25);

this.SetHScrollPos(this.GetHScrollPos() - deltaManipulation.Translation.X * 1.25);

}