Changing annotation manager userId

Product: Android

Product Version: 9.3.1

Please give a brief summary of your issue:
Annotations merged using fdfMerge, using annotation manager to manage permissions. Our userId can change, so I need to know how to edit the userID

Please describe your issue and provide steps to reproduce it:
We are adding annotations after the file has been loaded, using the following code block:

annotations?.forEach { annotation ->
  val fdfDoc = FDFDoc.createFromXFDF(annotation.xfdfString)
            val pdfDoc = pdfViewCtrlTabHostFragment?.currentPdfViewCtrlFragment?.pdfDoc
            try {
            } catch (e: PDFNetException) {

and adding the annotation manager to the fragment using the following code:

    currentPdfViewCtrlFragment?.toolManager?.let { toolManager ->
            val annotationBar = view?.findViewById<FrameLayout>(
            val vmProvider = ViewModelProvider(this)
            val toolManagerVm: ToolManagerViewModel =
            toolManager.enableAnnotManager(if (hasAnnotationPermission) userID else "-1")
            toolManagerVm.toolManager = toolManager

The userId that we pass into the annotaitonManager can be edited separately from the pdftron experience. When we add the annotation (first block of code), we know the current userID and we know if the annotation belongs to the new userId. Ideally we would like to update the userId to the new one here while we are adding the annotations to the form. And then pass in the new userId to the annotation manager, and be done with it.

Could you help me find the best way to edit an annotation to update the userId when we just have it in xfdf form?

Thank you!

Hi there,

Thank you for contacting Android support forums,

FDF doc is loop-able and you can update the annotation inside the loop:

fdfDoc = FDFDoc.createFromXFDF(xfdf);
    Obj fdf = fdfDoc.getFDF();
    if (fdf != null) {
        Obj annots = fdf.findObj("Annots");
        if (annots != null && annots.isArray()) {
            long size = annots.size();
            for (int i = 0; i < size; i++) {
                Obj annotObj = annots.getAt(i);

                if (annotObj != null) {
                    Annot annot = new Annot(annotObj);

Please give this a try and let us know how it works for you.

Best regards,
Kevin Kim

How do I change the title of the annot? And then how do I save it back to an fdfdoc to merge into the pdfDoc?

Hi there,

You can cast Annot to MarkUp and then call setTitle on it. Afterwards, you can put it back to the PDF via fdfMerge (PDFTron Systems Inc. | Documentation)

Best regards,
Kevin Kim