Getting Started on Xamarin.iOS

Warning

Nutrient Xamarin SDK (formerly PSPDFKit Xamarin for iOS and PSPDFKit Xamarin for Android) has been deprecated and replaced by Nutrient .NET for iOS and Nutrient .NET for Android. All Nutrient Xamarin licenses will remain valid and fully supported until 1 December 2025, or until your license expires, whichever occurs later. Interested in transitioning to another Nutrient product? Contact us and we’ll be happy to help.

Requirements

Creating a new Xamarin solution

  1. Open Visual Studio and select New Solution in the File > New Solution… menu to create a new solution for your application:

create-new-solution

  1. Choose the Single View App template for your solution:

app-template

  1. When prompted, choose your app name (“PSPDFKit-Demo”) and use the default options:

configure-ios-app

  1. Click the Next button and select the location to save the solution:

create-app

  1. Click the Create button to finish.

Install the Nutrient SDK via NuGet

  1. Make sure the PSPDFKit-Demo.sln is loaded in Visual Studio.

  2. Right-click your solution in Visual Studio and select the Manage NuGet Packages… menu:

manage-nuget-packages

  1. In the Browse section of nuget.org, search for PSPDFKit.

  2. Select the following two iOS packages: PSPDFKit.iOS.Model and PSPDFKit.iOS.UI:

add-pspdfkit-nuget-packages

  1. Tap on the Add Packages button to add the NuGet packages to your solution.

Displaying a PDF

  1. Add the PDF document you want to display to your application by dragging it into your solution’s resources. On the dialog that’s displayed, select Finish to accept the default integration options. You can use this Quickstart Guide PDF as an example.

drag-and-drop-document

  1. Import PSPDFKit and PSPDFKitUI at the top of your ViewController.cs:

using PSPDFKit.Model;
using PSPDFKit.UI;
  1. Load your PDF document and display the view controller by implementing ViewDidAppear(Boolean) in the ViewController.cs file like so:

public override void ViewDidAppear(bool animated)
{
	base.ViewDidAppear(animated);

	// Update to use your document name.
	var document = new PSPDFDocument(NSUrl.FromFilename("Document.pdf"));

	// The configuration object is optional and allows additional customization.
	var configuration = PSPDFConfiguration.FromConfigurationBuilder((builder) => {
		builder.PageMode = PSPDFPageMode.Single;
		builder.PageTransition = PSPDFPageTransition.ScrollContinuous;
		builder.ScrollDirection = PSPDFScrollDirection.Vertical;
	});
	var pdfViewController = new PSPDFViewController(document, configuration);

	// Present the PDF view controller within a `UINavigationController` to show built-in toolbar buttons.
	var navController = new UINavigationController(rootViewController: pdfViewController);
	_ = this.PresentViewControllerAsync(navController, animated: true);
}

Next steps

You can find more about Xamarin integration in our GitHub project, and our guides.

Warning

Nutrient Xamarin SDK (formerly PSPDFKit Xamarin for iOS and PSPDFKit Xamarin for Android) has been deprecated and replaced by Nutrient .NET for iOS and Nutrient .NET for Android. All Nutrient Xamarin licenses will remain valid and fully supported until 1 December 2025, or until your license expires, whichever occurs later. Interested in transitioning to another Nutrient product? Contact us and we’ll be happy to help.

Requirements

Install the Nutrient SDK via NuGet

  1. Open your solution in Visual Studio:

open path/to/YourSolution.sln
  1. Right-click your solution in Visual Studio and select the Manage NuGet Packages… menu:

manage-nuget-packages

  1. In the Browse section of nuget.org, search for PSPDFKit.

  2. Select the following two iOS packages: PSPDFKit.iOS.Model and PSPDFKit.iOS.UI:

add-pspdfkit-nuget-packages

  1. Tap on the Add Packages button to add the NuGet packages to your solution.

Displaying a PDF

  1. Add the PDF document you want to display to your application by dragging it into your solution’s resources. On the dialog that’s displayed, select Finish to accept the default integration options. You can use this Quickstart Guide PDF as an example.

drag-and-drop-document

  1. Import PSPDFKit and PSPDFKitUI at the top of your ViewController.cs:

using PSPDFKit.Model;
using PSPDFKit.UI;
  1. Load your PDF document and display the view controller. This can be done in a button action handler, table view cell selection delegate, or similar:

// Update to use your document name.
var document = new PSPDFDocument(NSUrl.FromFilename("Document.pdf"));

// The configuration object is optional and allows additional customization.
var configuration = PSPDFConfiguration.FromConfigurationBuilder((builder) => {
	builder.PageMode = PSPDFPageMode.Single;
	builder.PageTransition = PSPDFPageTransition.ScrollContinuous;
	builder.ScrollDirection = PSPDFScrollDirection.Vertical;
});
var pdfViewController = new PSPDFViewController(document, configuration);

// Present the PDF view controller within a `UINavigationController` to show built-in toolbar buttons.
var navController = new UINavigationController(rootViewController: pdfViewController);
_ = this.PresentViewControllerAsync(navController, animated: true);
  1. Build and run your application.

Next steps

You can find more about Xamarin integration in our GitHub project, and our guides.

Warning

Nutrient Xamarin SDK (formerly PSPDFKit Xamarin for iOS and PSPDFKit Xamarin for Android) has been deprecated and replaced by Nutrient .NET for iOS and Nutrient .NET for Android. All Nutrient Xamarin licenses will remain valid and fully supported until 1 December 2025, or until your license expires, whichever occurs later. Interested in transitioning to another Nutrient product? Contact us and we’ll be happy to help.

Requirements

Cloning the Catalog sample project

  1. Open the Terminal app and change the current working directory. In this case, use the ~/Downloads directory:

cd ~/Downloads
  1. Clone the Nutrient Xamarin for iOS repository:

git clone https://github.com/PSPDFKit/Xamarin-iOS.git
  1. Change the current working directory to the root directory:

cd Xamarin-iOS
  1. Run the following command to download the Nutrient dependencies:

./build.sh --target DownloadDeps
  1. Wait a few moments for the dependencies to download.

  2. Open the Nutrient solution (PSPDFKit.sln) in Visual Studio:

open PSPDFKit.sln
  1. Build and run the PSPDFCatalog on an iOS Simulator.

catalog-simulator

Next steps

You can find more about Xamarin integration in our GitHub project, and our guides.