---
title: "Adding a vector image annotation from Instant JSON"
canonical_url: "https://www.nutrient.io/guides/ios/knowledge-base/adding-vector-image-annotation-from-instant-json/"
md_url: "https://www.nutrient.io/guides/ios/knowledge-base/adding-vector-image-annotation-from-instant-json.md"
last_updated: "2026-05-26T01:23:09.661Z"
description: "This article outlines how to add a vector image annotation that’s a PDF using Instant JSON. for Nutrient iOS SDK."
---

This article outlines how to add a vector image annotation that’s a PDF using Instant JSON.

Vector images should be single-page PDFs. These can be embedded in other PDFs as image annotations.

In Instant JSON, the type of these annotations should be [`pspdfkit/image`](https://www.nutrient.io/guides/document-engine/json/schema/annotations/) rather than [`pspdfkit/stamp`](https://www.nutrient.io/guides/document-engine/json/schema/annotations/). The custom stamp type is for stamps that show custom text but with a predefined style, while images can display any JPEG, PNG, or PDF image. However, for compatibility reasons, our iOS API doesn’t make this distinction: It models both stamps and images using the `PSPDFStampAnnotation` class.

The `contentType` should be set to `application/pdf`.

Here’s how to add an annotation with a PDF attachment using Instant JSON. The source image comes from `my-custom-graphic.pdf` in the app’s bundle:

```objc

PSPDFDocument *document =...
NSData *instantJSONData = [@"{ \"type\": \"pspdfkit/image\", \"bbox\": [100, 100, 200, 200], \"v\": 1, \"pageIndex\": 0, \"opacity\": 1 }" dataUsingEncoding:NSUTF8StringEncoding];
NSData *attachmentData = [NSData dataWithContentsOfURL:[NSBundle.mainBundle URLForResource:@"my-custom-graphic" withExtension:@"pdf"]];

// Create an annotation from Instant JSON data.
NSError *annotationCreationError;
PSPDFAnnotation *imageAnnotation = [PSPDFAnnotation annotationFromInstantJSON:instantJSONData documentProvider:document.documentProviders.firstObject error:&annotationCreationError];
if (!imageAnnotation) {
    // Handle error.
}

// Create the data container provider using the attachment data.
PSPDFDataContainerProvider *dataContainerProvider = [[PSPDFDataContainerProvider alloc] initWithData:attachmentData];

// Attach the attachment data.
NSError *attachBinaryError;
BOOL success = [imageAnnotation attachBinaryInstantJSONAttachmentFromDataProvider:dataContainerProvider error:&attachBinaryError];
if (!success) {
    // Handle error.
}

// Add the newly loaded annotation to the document.
[document addAnnotations:@[imageAnnotation] options:nil];

```

You can read more about this approach in our [Instant JSON](https://www.nutrient.io/guides/ios/importing-exporting/instant-json.md#attaching) guide.
---

## Related pages

- [Adding Swipe Gesture Recognizer](/guides/ios/knowledge-base/adding-swipe-gesture-recognizer.md)
- [Fix app store connect operation errors in Xcode](/guides/ios/knowledge-base/app-store-connect-operation-errors.md)
- [Adjusting Size Of Popovers](/guides/ios/knowledge-base/adjusting-size-of-popovers.md)
- [Archive Errors Cocoapods](/guides/ios/knowledge-base/archive-errors-cocoapods.md)
- [Configuring Scroll Views](/guides/ios/knowledge-base/configuring-scroll-views.md)
- [Customize your iOS navigation bar above crop UI](/guides/ios/knowledge-base/customize-the-navigation-bar-in-crop.md)
- [Customize PDF rendering on iOS](/guides/ios/knowledge-base/customize-document-rendering.md)
- [Customize Share Sheet Apps](/guides/ios/knowledge-base/customize-share-sheet-apps.md)
- [Customizing Annotation Toolbar Frame](/guides/ios/knowledge-base/customizing-annotation-toolbar-frame.md)
- [Debugging Issues](/guides/ios/knowledge-base/debugging-issues.md)
- [Disabling Adding Pages With Images](/guides/ios/knowledge-base/disabling-adding-pages-with-images.md)
- [Disabling Auto Opening Comments](/guides/ios/knowledge-base/disabling-auto-opening-comments.md)
- [Disabling Directional Lock](/guides/ios/knowledge-base/disabling-directional-lock.md)
- [Adding a custom view controller in iOS](/guides/ios/knowledge-base/how-do-i-add-custom-controller-to-containerviewcontroller.md)
- [Disabling Text Selection](/guides/ios/knowledge-base/disabling-text-selection.md)
- [Drawing An Upright Stamp Annotation On A Rotated Page](/guides/ios/knowledge-base/drawing-an-upright-stamp-annotation-on-a-rotated-page.md)
- [Generate PDFs from complex HTML](/guides/ios/knowledge-base/generating-pdf-from-complex-html.md)
- [Gatekeeper Alerts Mac Catalyst](/guides/ios/knowledge-base/gatekeeper-alerts-mac-catalyst.md)
- [Customize action sheet appearance on iOS links](/guides/ios/knowledge-base/hide-or-customize-the-action-sheet-link-long-press.md)
- [How Do I Change How To Open Links](/guides/ios/knowledge-base/how-do-i-change-how-to-open-links.md)
- [How Do I Customize Search Results](/guides/ios/knowledge-base/how-do-i-customize-search-results.md)
- [Capture ink signatures using SignatureViewController](/guides/ios/knowledge-base/how-do-i-get-an-image-from-signatureviewcontroller.md)
- [How Do I Customize The Annotation Inspector](/guides/ios/knowledge-base/how-do-i-customize-the-annotation-inspector.md)
- [How Do I Download Pspdfkit As Fat Frameworks](/guides/ios/knowledge-base/how-do-i-download-pspdfkit-as-fat-frameworks.md)
- [How Do I Migrate From Cocoapods To Spm](/guides/ios/knowledge-base/how-do-i-migrate-from-cocoapods-to-spm.md)
- [Get notifications for unlocked password-protected PDFs](/guides/ios/knowledge-base/how-do-i-get-notified-when-a-password-protected-document-is-unlocked.md)
- [Other dependencies.](/guides/ios/knowledge-base/how-do-i-migrate-from-carthage-to-spm.md)
- [How to add annotations programmatically in iOS](/guides/ios/knowledge-base/how-do-i-programmatically-add-annotation-to-the-saved-annotations-list.md)
- [How Do I Present A Pspdftabbedviewcontroller In Cordova](/guides/ios/knowledge-base/how-do-i-present-a-pspdftabbedviewcontroller-in-cordova.md)
- [Fix incorrect page color in night appearance mode](/guides/ios/knowledge-base/how-do-i-reset-custom-document-render-options-before-change-the-appearance-mode.md)
- [How Do I Remove The Sign Arrow From The Signature Form Field](/guides/ios/knowledge-base/how-do-i-remove-the-sign-arrow-from-the-signature-form-field.md)
- [How Do I Select Or Deselect An Annotation Programmatically](/guides/ios/knowledge-base/how-do-i-select-or-deselect-an-annotation-programmatically.md)
- [Processor Write To File Url](/guides/ios/knowledge-base/processor-write-to-file-url.md)
- [Creating invisible digital signatures on iOS](/guides/ios/knowledge-base/invisible-signature.md)
- [Fixing library not found issues in iOS apps](/guides/ios/knowledge-base/library-not-found-swiftpm.md)
- [Block annotation editing and deletion in iOS](/guides/ios/knowledge-base/prevent-annotation-editing-allow-manipulation.md)
- [Separate Photo Library And Camera Actions](/guides/ios/knowledge-base/separate-photo-library-and-camera-actions.md)
- [Search Special Characters](/guides/ios/knowledge-base/search-special-characters.md)
- [Showing Annotation Tools In The Main Toolbar](/guides/ios/knowledge-base/showing-annotation-tools-in-the-main-toolbar.md)
- [Setting The Initial Page Selection When Sharing](/guides/ios/knowledge-base/setting-the-initial-page-selection-when-sharing.md)
- [How to store electronic signatures using Instant JSON](/guides/ios/knowledge-base/store-electronic-signatures-from-instant-json-annotations.md)
- [Suppressing File Coordination Alerts](/guides/ios/knowledge-base/suppressing-file-coordination-alerts.md)
- [Zoom to specific PDF annotations easily](/guides/ios/knowledge-base/zoom-to-specific-annotation.md)

