Pixelnetica Document Scanning SDK* (DSSDK) provides developers with an intelligent, highly efficient toolkit, which offers an easy way to add image processing features that are optimized for document photos that are taken by a mobile device or document camera to their applications.
Designed to ensure the smooth operation of a paperless work-flow by pre-processing paper document images, SDK makes them easier to handle by text recognition (or optical character recognition - OCR) programs, enhancing the visual quality and legibility of documents.
For more information about DSSDK main Features and Benefits please visit Pixelnetica website.
*Former Document Imaging SDK

Please feel free to contact us for Free DSSDK Trial, Quotation or in case of any questions.


Supported iOS versions

  • Apple iOS 7 and above.

Demo Application

To demonstrate most of the Document Scanning SDK features and the way they should be used in a real application, we prepared demo application available in source codes available by the link below.

⚠️ Important Note.
Demo application source code provided “as is” without warranties of any kind. It could be freely used in commercial product only in case of commercial DSSDK license purchase.

Getting started


The Document Scanning SDK (DSSDK) is provided as NuGet packages for Xamarin.iOS Platform.

To install DSSDK in Visual Studio IDE:

  1. Open your App-Solution in Visual Studio.
  2. Select your iOS project and click on the menu item Project => Add NuGet Packages.
  3. Set nuget.org as source and search for package ID: Pixelnetica.DSSDK.Xamarin.iOS.
  4. Click on Add Package to download and install the DSSDK into your project.

After following the steps above the Document Scanning SDK will be ready to use in your code.


The NuGet package for iOS contains Xamarin Bindings to the Native SDK Library API, which is accesssible through the DocScanningSDK namespace.

Documentation for the native DSSDK can be found inside the iOS Document Scanning SDK documentation.

SDK initialization

The DSSDK must be initialized before usage. Make sure to run the initialization only once per application lifetime.

Just add the following code somewhere before you use the DSSDK API, e.g. in the Main() function:

static void Main( string[] args )
    string key = "prpObFZAkWAZNPMGgIA/uMBLJfOj3pAzasxMoglnCmmpCoy5rTE6VqE0Tq6yXy56GafMFiTMeIXtRcgi8MW5Ulmlet889IkpiLRK7rcowpFfJj5yGMnbyI0qXEpIFTqf9X1NwIfNBfpIHrArHCK6HS0P4Jx4w5G8nHvN9sp3yyX9cY67mN9cJKNNN+hPTq+GW9wfn+rd+lLgQUVp5ob5zm/1JHp35TYQq4mq7JpSTbZpS0P7S5YtD61jyXeXpvgik+QIqUUILlPKV2URIuVpm7fH09kanknd33WkDoR0exds04MkyJvzrK7n6+DoQGF1999gA3PzZWtYqkQ00DFM9A==";

    PxLicense.InitializeWithKey( key );

    UIApplication.Main( args, null, nameof( PhotoSliderAppDelegate ) );

Where key parameter passed to PxLicense.InitializeWithKey is the Licence Key obtained from Pixelnetica.

⚠️ Important Note.
Document Scanning SDK trial version comes with Trial License Key bound to the demo application.
It could also be utilised in other applications for development and testing purpose only where it will generate final images (documents) with watermarks.

It is strictly prohibited to distribute, market, publish to application stores like, but not limited, AppStore, Google Play, etc or use other than for development or staging purposes Pixelnetica Document Scanning SDK trial license.

DocScanningSdk API modules


Is the core DSSDK class which exposes the document detection, correction and binarization API. All class methods are static.

Load image with metadata using the PxMetaImage object

The most straightforward way is to use the UIImagePicker/UIImagePickerControllerDelegate:

class ImagePickerControllerDelegate : UIImagePickerControllerDelegate
    public override void FinishedPickingMedia( UIImagePickerController picker, NSDictionary info )
        NSUrl assetURL = (NSUrl)info.ObjectForKey( UIImagePickerController.ReferenceUrl );
        if( assetURL != null )
            Action<ALAsset> resultBlock = delegate( ALAsset myasset ) {
                NSDictionary metadata = myasset.DefaultRepresentation.Metadata;

                IImage image = new UIImage( myasset.DefaultRepresentation.GetFullScreenImage() );

                PxMetaImage metaImage = PxMetaImage.CreateWithMetadata( image, metadata );


            Action<NSError> failureBlock = delegate( NSError myerror ) {

            ALAssetsLibrary assetsLib = new ALAssetsLibrary();

            assetsLib.AssetForUrl( assetURL, resultBlock, failureBlock );

Get maxmimum supported image size and scale image if needed

UIImage image = metaImage.Image;
CGSize maxSuportedSize = PxSDK.SupportedImageSize( image.Size );
if( image.Size != maxSuportedSize )
    // Resize input image if its size is greater than the supported maximum
    metaImage.Image = ImageUtils.ScaleImage( image, maxSuportedSize );

There are several otherways to create PxMetaImage objects.

Document corners detection

Use PxSDK.DetectDocumentCorners() to detect document corners, specified by the previously loaded PxMetaImage:

PxDocCorners docCorners;
if( PxSDK.DetectDocumentCorners( metaImage, out docCorners ) )
    bool isSmartCropMode = docCorners.isSmartCropMode;

    PxRectangle corners;
    corners.leftTop = docCorners.ptUL;
    corners.rightTop = docCorners.ptUR;
    corners.leftBotton = docCorners.ptBL;
    corners.rightBotton = docCorners.ptBR;


We Use PxPoint, PxSize, PxRetangele and PxDocCorners structures to pass parameters and receive results. PxPoint and PxSize can be easily converted to CGPoint and CGSize respectively like this:

CGPoint cgPoint = new CGPoint();
PxPoint point = PxPoint.FromCGPoint( cgPoint );
cgPoint = point.ToCGPoint();

CGSize cgSize = new CGSize();
PxSize size = PxSize.FromCGSize( cgSize );
cgSize = size.ToCGSize();

After this you can let user to accept or modify document detection results.

Document cropping and correction

MetaImage croppedMetaImage = PxSDK.CorrectDocument( sourceMetaImage, ref corners );

Image processing and binarization

There are four methods for image processing and binarization:

  • Apply only image rotation leaving Original colors untouched.
    targetMetaImage = PxSDK.ImageOriginal( croppedMetaImage );

  • Binarize to Black and White image.
    targetMetaImage = PxSDK.ImageBWBinarization( croppedMetaImage );

  • Convert to Grayscale image.
    targetMetaImage = PxSDK.ImageGrayBinarization( croppedMetaImage );

  • Enhance image Colors.
    targetMetaImage = PxSDK.ImageColorBinarization( croppedMetaImage );

PxImageWriter class

Module creation

We recommend utilize using statement to automatically free and destroy writer instance.

using( PxImageWriter writer = PxImageWriter.CreateWithType( PxImageWriter_Type.Pdf ) )

You can specify a several writer types

  • PxImageWriter_Type.Jpeg to write color JPEG image.

  • PxImageWriter_Type.Png to write color PNG image.

  • PxImageWriter_Type.PngExt to write 1-bit black-and-white PNG image.

  • PxImageWriter_Type.Tiff to write 1-bit Black-and-White TIFF-G4 compressed image. Creates most compact black-and-white files.

  • PxImageWriter_Type.Pdf to write a PDF document.

Writing images

To write one or several images (or pages) specify image or document file path

writer.Open( filePath );

You can also specify additional optional parameters for specific writer types. E.g. compression for JPEG or page size for PDF.

writer.ConfigureWithInt( key, intValue );
writer.ConfigureWithFloat( key, floatValue );
writer.ConfigureWithString( key, stringValue );

Write one image (or page). You can call it many times to write multiple pages:

writer.Write( image );

For more details we strongly recommend to take a close look at our demo applications source codes.

Still have Questions, need Free Trial or Quotation?

Feel free to contact us in case of any inquires at Pixelnetica DSSDK Support.