Some test text!

menu
search

Compare files with overlay

PDFTron SDK allows you to compare files visually using overlays.

File comparison

This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here.

The PDFTron SDK provides powerful file comparison functionality. An example of this capability is shown below by comparing two PDF pages and highlighting the difference between them in red.

File 1File 2Difference
File 1File 2Diff

linkShow a file comparison view controller

The PTDiffViewController class shows a control to select two documents and create a new file showing the visual difference between them with customizable colors.

Diff view controller

The file comparison control is part of the Tools library, so make sure you have added the Tools library to your project.

// Initialize a file comparison view controller.
var diffController = new PTDiffViewController();

diffController.DidCreateDiffFileAtURL += (sender, e) =>
{
    // Handle created diff file.
};

var navigationController = new UINavigationController(diffController);
if (!UserInterfaceIdiomIsPhone)
{
    navigationController.ModalPresentationStyle = UIModalPresentationStyle.Popover;

    navigationController.PopoverPresentationController.SourceView = btn;
    navigationController.PopoverPresentationController.SourceRect = btn.Bounds;
}

this.PresentViewController(navigationController, true, null);
The diff view controller must be pushed onto a navigation controller's stack before being shown.
Retrieving the file comparison output.
The PTDiffViewController creates an output file showing the visual difference between the two documents in a temporary directory and returns an NSURL with the file's location via a delegate method. To save and display the file, you must conform to the PTDiffViewControllerDelegate protocol.

linkFile comparison sample code

The following sample code demonstrates how to use PDFNet to generate a document displaying the visual difference between two PDF pages:

// Xamarin sample code coming soon

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn More
close