How to set title property for PTAnnot

Product:PDFTron Demo

Please give a brief summary of your issue:

→ We have to set title for annotations. Because, we will need title property in extraction of xfdf .
→ We are doing this with following toolmanager delegate approach. But, Undo and Redo button is not working properly after using this way:

func toolManager(_ toolManager: PTToolManager, annotationAdded annotation: PTAnnot, onPageNumber pageNumber: UInt) {
        if let markup = annotation as? PTMarkup, markup.isValid() {
            markup.setTitle("Guest")
        }
    }

→ Is their any other way we can set Title property for PTAnnot?

Thanks.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi there,

You can use the PTToolManager.annotationAuthor property to set an author name/identifier to be applied to all new annotations.

1 Like

Hey,

Thanks @dluco for solution.

Just one more question in same context:
We are using below function to add Image stamp annotation from tool bar.

 let imageAttachItem = documentController.toolGroupManager.createItem(forToolClass: PTImageStampCreate.self)

But this is not setting title = “Guest” for image annotations. For other mark up your solution is working fine.

Is their any specific way to add title property for ImageStampAnnotations?

For image-stamp annotations it does look like the annotation author/title is not being set. We will fix that in an update to the SDK.

Thanks @dluco for confirming that.
Please let us know once it is fixed.

Hi @dluco,
Can you give us a temporary build solution for this issue? So until you release a new version, we can start implementing our flow.

The experimental nightly build here includes changes that address the issue with image-stamp annotations:
https://nightly-pdftron.s3-us-west-2.amazonaws.com/experimental/2022-04-21/cocoapods/xcframeworks/pdfnet/2022-04-21_experimental_rev79742.podspec

The next official release of the SDK will also include the same changes.

Hi @dluco ,
We have tried above build but now app is getting crash on extracting xfdf and saveAsXFDFToString() after adding image annotation.

Thank you for letting us know about the issue with the experimental nightly build - we are looking into it on our side and will let you know when we have an update for you.

Hi @dluco,
Please update us once it is fixed.

Hello @rankit.agarwal,

We recently released v9.2.2 of the PDFTron iOS SDK which includes some fixes when adding image stamp annotations. In my testing I was unable to reproduce the crash when extracting the XFDF using this version.

Are you able to update to the latest release and let us know if you’re still seeing the crash?

1 Like