---
title: "Import Instant JSON into a PDF | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/annotations/import-instant-json-into-pdf/"
md_url: "https://www.nutrient.io/guides/dotnet/annotations/import-instant-json-into-pdf.md"
last_updated: "2026-06-26T00:00:00.000Z"
description: "Import Instant JSON annotations, form fields, comments, and bookmarks into a PDF using Nutrient .NET SDK."
---

# Import Instant JSON into a PDF

Instant JSON is Nutrient's portable format for moving annotations, form fields, form field values, comments, and bookmarks between PDF documents. Importing an Instant JSON file applies those objects to an existing PDF. Use it to reattach review markup, sync changes from a back-end service, or move data between Nutrient SDKs.

This guide shows how to:

- Load a base PDF document

- Apply an Instant JSON file containing annotations to that PDF

- Save the modified PDF with the imported objects in place

## Prepare the project

Start by registering the SDK license before you process documents. For setup details, refer to the [getting started with.NET SDK](https://www.nutrient.io/sdk/dotnet/getting-started.md) guide.

```csharp

using GdPicture14;

LicenseManager licence = new LicenseManager();
licence.RegisterKEY(""); // Set your license key

```

## Load the PDF document

Begin with the PDF that will receive the imported objects. The same Instant JSON file can apply to many different PDFs, so the receiving document doesn't need to know anything about the JSON ahead of time. Load it with [`LoadFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html):

```csharp

using GdPicturePDF pdf = new GdPicturePDF();
pdf.LoadFromFile(@"input.pdf");

```

## Count existing annotations

Capture the annotation count before you import with [`GetAnnotationCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetAnnotationCount.html) so you can verify how many objects the import added:

```csharp

int annotationCountBefore = pdf.GetAnnotationCount();

```

## Import the Instant JSON file

[`ImportInstantJSONDataFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportInstantJSONDataFromFile.html) reads an Instant JSON document and writes its annotations, form fields, form field values, bookmarks, and comments into the loaded PDF. The method returns `GdPictureStatus`, so always check the result before you continue:

```csharp

GdPictureStatus importStatus = pdf.ImportInstantJSONDataFromFile(@"test_annotations_instant.json");
if (importStatus!= GdPictureStatus.OK)
{
    Console.Error.WriteLine($"Instant JSON import failed: {importStatus}");
    Environment.Exit(1);
}

```

The import is additive, so the source PDF's existing annotations and form fields stay in place. If you need an authoritative replacement, remove the existing objects first.

## Confirm the import

Compare the annotation count before and after with [`GetAnnotationCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetAnnotationCount.html) to confirm that the import landed:

```csharp

int annotationCountAfter = pdf.GetAnnotationCount();
Console.WriteLine($"Annotations before import: {annotationCountBefore}");
Console.WriteLine($"Annotations after import: {annotationCountAfter}");

```

## Save the modified PDF

[`ImportInstantJSONDataFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportInstantJSONDataFromFile.html) mutates the in-memory PDF only. Call [`SaveToFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html) to persist the change:

```csharp

GdPictureStatus saveStatus = pdf.SaveToFile(@"output.pdf");
if (saveStatus!= GdPictureStatus.OK)
{
    Console.Error.WriteLine($"Saving PDF failed: {saveStatus}");
    Environment.Exit(1);
}

```

## Error handling

The import path validates the Instant JSON before it applies changes. Common failure cases include:

- `GdPictureStatus.PdfDocumentMustBeUnencrypted` — Instant JSON import refuses to operate on encrypted PDFs

- `GdPictureStatus.FileNotFound` — the path you pass to `ImportInstantJSONDataFromFile` doesn't exist

- `GdPictureStatus.GenericError` — malformed Instant JSON or a `pdfId` mismatch between the JSON and the loaded PDF. Version-mode imports validate this strictly.

For status-handling patterns, refer to the [handling errors with.NET SDK](https://www.nutrient.io/guides/dotnet/best-practices.md#error-handling) guide.

## Conclusion

This guide imports an Instant JSON file into a PDF and layers its annotations and form data on top of the existing document. Pair it with the [export guide](https://www.nutrient.io/guides/dotnet/annotations/export-instant-json-from-pdf.md) to round-trip changes between systems.
---

## Related pages

- [Configure Instant JSON appearance and tracking](/guides/dotnet/annotations/configure-instant-json-appearance-and-tracking.md)
- [Attach a file to an annotation in C#](/guides/dotnet/annotations/attach-a-file.md)
- [Annotate on images in C# .NET](/guides/dotnet/annotations/annotate-on-images.md)
- [Attach an image to an annotation in C#](/guides/dotnet/annotations/attach-an-image.md)
- [Convert between Instant JSON and XFDF](/guides/dotnet/annotations/convert-between-instant-json-and-xfdf.md)
- [Convert between Instant JSON and XMP](/guides/dotnet/annotations/convert-between-instant-json-and-xmp.md)
- [Create an annotation in a PDF using C#](/guides/dotnet/annotations/create.md)
- [Custom annotations](/guides/dotnet/annotations/custom-annotations.md)
- [Edit PDF annotations in C#](/guides/dotnet/annotations/edit.md)
- [Export Instant JSON from a PDF](/guides/dotnet/annotations/export-instant-json-from-pdf.md)
- [Export annotation data from PDFs in C# .NET](/guides/dotnet/annotations/export-pdf.md)
- [Get PDF annotation properties in C# .NET](/guides/dotnet/annotations/get-properties.md)
- [Export XMP annotation data in C# .NET](/guides/dotnet/annotations/export-xmp.md)
- [Flatten PDF annotations in C# .NET](/guides/dotnet/annotations/flatten.md)
- [Import XFDF annotation data to PDFs in C# .NET](/guides/dotnet/annotations/import-xfdf.md)
- [Import XMP annotation data to PDF or image in C#](/guides/dotnet/annotations/import-xmp.md)
- [Instant JSON appearance theme comparison](/guides/dotnet/annotations/instant-json-appearance-theme-comparison.md)
- [PDF annotations in C#.NET](/guides/dotnet/annotations.md)
- [Remove PDF annotations in C# .NET](/guides/dotnet/annotations/remove.md)
- [Add PDF actions using C# in form fields](/guides/dotnet/annotations/pdf-actions-support.md)
- [Stamp a PDF document in C# .NET](/guides/dotnet/annotations/stamp-a-document.md)
- [XMP annotations in C# .NET](/guides/dotnet/annotations/xmp-annotations.md)

