Nutrient Web SDK

ReferenceSerializers

Namespace Serializers

This namespace contains types and interfaces for serializing and deserializing PDF annotations, form fields, comments, bookmarks, and related data to and from JSON representations compatible with the Nutrient Web SDK. These serialised objects can be used in InstantJSON

You can use NutrientViewer.Annotations.toSerializableObject to create serialised object from an annotation.

const annotation = new NutrientViewer.Annotations.TextAnnotation({
pageIndex: 0,
text: { format: "plain", value : "Welcome to\nNutrientViewer" },
font: "Helvetica",
boundingBox: new NutrientViewer.Geometry.Rect({ left: 10, top: 20, width: 30, height: 40 }),
});

const serialisedAnnotation = NutrientViewer.toSerializableObject(annotation);

You can use NutrientViewer.FormFields.toSerializableObject to create serialised object from a form field.

const formField = new NutrientViewer.FormFields.TextFormField({
pageIndex: 0,
value: "Hello, world!",
});

const serialisedFormField = NutrientViewer.FormFields.toSerializableObject(formField);

You can use NutrientViewer.Bookmark.toSerializableObject to create serialised object from a bookmark.

const bookmark = new NutrientViewer.Bookmarks.Bookmark({
pageIndex: 0,
name: "Bookmark 1",
action: new NutrientViewer.Actions.GoToAction({ pageIndex: 0 }),
});

const serialisedBookmark = NutrientViewer.Bookmark.toSerializableObject(bookmark);

You can use NutrientViewer.Comment.toSerializableObject to create a serialised object from a comment.

const comment = new NutrientViewer.Comments.Comment({
pageIndex: 0,
text: { format: "plain", value : "Welcome to\nNutrientViewer" },
});

const serialisedComment = NutrientViewer.Comment.toSerializableObject(comment);
Namespace

Action

Annotation

Bookmark

Comment

FormField

FormFieldValue

FormOption