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

# Export Instant JSON from a PDF

Instant JSON is Nutrient's portable, human-readable format for sharing annotations, form fields, form field values, comments, and bookmarks across PDF documents. Use it to move review data between back-end services, store changes outside the PDF, or transfer data between Nutrient SDKs without modifying the underlying file.

This guide shows how to:

- Load an existing PDF with form fields and add annotations programmatically

- Export the document's data as an Instant JSON file

- Produce both a diff export, which is the default, and a full-state export

## 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 source PDF that already contains content you want to export. In this sample, the file includes a form with three text fields. 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(@"test_form_fields.pdf");

```

## Add annotations programmatically

Add a few annotations so the export includes more than the pre-existing form fields. Each [`AddSquareAnnotation`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~AddSquareAnnotation.html) and [`AddStickyNoteAnnotation`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~AddStickyNoteAnnotation.html) call mutates the loaded document and the change tracker records it:

```csharp

pdf.AddSquareAnnotation(72, 144, 200, 60, "Reviewer", "Highlighted region", 2.0f,
    PdfAnnotationBorderStyle.PdfAnnotationBorderStyleSolid, 0, 0, 1.0f, 255, 0, 0);
pdf.AddStickyNoteAnnotation(PdfStickyNoteAnnotationIcon.PdfAnnotationIconComment,
    72, 220, "Reviewer", "Section question", "Please confirm this section.",
    1.0f, false, 255, 255, 0, 0, 0, 0, 0);

```

## Export the diff Instant JSON

By default, [`ExportInstantJSONDataToFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ExportInstantJSONDataToFile.html) produces a diff. It includes only items that changed after the document loaded. This matches the Core SDK's `export_document_json` behavior and works well when you sync changes back to a server:

```csharp

GdPictureStatus exportStatus = pdf.ExportInstantJSONDataToFile(@"output.json");
if (exportStatus!= GdPictureStatus.OK)
{
    Console.Error.WriteLine($"Instant JSON export failed: {exportStatus}");
    Environment.Exit(1);
}

```

The resulting `output.json` includes the two annotations added above, but it doesn't repeat the form fields that were already in the source PDF.

## Export the full-state Instant JSON

When you need a complete snapshot, pass `fullState: true` to the stream overload. Use [`ExportInstantJSONDataToStream`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ExportInstantJSONDataToStream.html) for archival, document hand-off, or first-time syncs when the receiver doesn't yet have the original PDF:

```csharp

using (FileStream fullStream = new FileStream(@"output_full.json", FileMode.Create, FileAccess.Write))
{
    GdPictureStatus fullExportStatus = pdf.ExportInstantJSONDataToStream(fullStream, fullState: true);
    if (fullExportStatus!= GdPictureStatus.OK)
    {
        Console.Error.WriteLine($"Full Instant JSON export failed: {fullExportStatus}");
        Environment.Exit(1);
    }
}

```

## Diff vs. full state — which one to use

Choose the export shape that matches the workflow:

- **Diff export** (default) — Stream incremental updates. A server holds the source PDF, the client edits annotations, and the client sends back only what changed.

- **Full export** (`fullState: true`) — Snapshot the document. Use this to archive a complete record of every annotation and form field, or to seed a new document that doesn't yet share the source.

Both shapes use the same Instant JSON schema, so the same [`ImportInstantJSONDataFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ImportInstantJSONDataFromFile.html) call accepts either one.

## Error handling

Always check the `GdPictureStatus` returned by each export call. Common failure modes include:

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

- `GdPictureStatus.GenericError` — typically means no PDF is loaded

- IO errors when the output path can't be written

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 exports a PDF's annotations and form data as Instant JSON, with both diff and full-state shapes available depending on the workflow. Pair it with the [import guide](https://www.nutrient.io/guides/dotnet/annotations/import-instant-json-into-pdf.md) to round-trip changes between documents. For bridge workflows, refer to the [Instant JSON and XFDF](https://www.nutrient.io/guides/dotnet/annotations/convert-between-instant-json-and-xfdf.md) and [Instant JSON and XMP](https://www.nutrient.io/guides/dotnet/annotations/convert-between-instant-json-and-xmp.md) guides.
---

## 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 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)
- [Import Instant JSON into a PDF](/guides/dotnet/annotations/import-instant-json-into-pdf.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)

