3

What is the problem?

By using PDFBOX I tried to tag a link which contains annotation. The PDF creating sample code is here. I tagged a nested paragraph link by using PDFBOX. The newly created tagged PDF is passing the Adobe checker.

What I observed?

After tagging pdf I tried to read it using JAWS. But unfortunately the jaws is not reading links in both "entire document mode" and "read currently visible page" mode. Then I jumped to StructTree Root and compared with adobe created tagged PDF vs our tagged PDF. The ParentTree(NUMTree) is not matching with adobe tagged pdf.

Tagged by me

Tagged by Adobe

What I Tried?

I tried to replicate the adobe numtree in my pdf. Almost I am able to create same but except one object. enter image description here

Above image left side is adobe tagged and right side is created by me. I didn't understand the adobe why it is created entire structtree under this (142 O R) object? I am adding annotation object to TumTree by using this code

    private void addWidgetContent(PDObjectReference objectReference, PDStructureElement fieldElem, String type, int pageIndex) {
        COSDictionary annotDict = new COSDictionary();
        COSArray annotArray = new COSArray();
        annotArray.add(COSInteger.get(currentMCID));
        annotArray.add(objectReference);
        annotDict.setItem(COSName.K, annotArray);
        annotDict.setString(COSName.LANG, "EN-US");
        annotDict.setItem(COSName.P, currentElem.getCOSObject());
        annotDict.setItem(COSName.PG, pages.get(pageIndex).getCOSObject());
        annotDict.setName(COSName.S, type);
        annotDicts.add(annotDict);

        setNextMarkedContentDictionary();
        numDictionaries.add(annotDict);
        fieldElem.appendKid(objectReference);
        currentElem.appendKid(fieldElem);
    }

And one more bug I saw in Adobe preflight is enter image description here

How can I fix these bugs and what is the correct way of tagging link annotation to be read by JAWS? Please help me .......

I got some update to share. Now I crated parent tree root without having any bugs. Here the file tagged pdf file. enter image description here

Still this tagged pdf not reading links. Why ?????????

  • I tried with this https://stackoverflow.com/questions/59377820/how-to-heal-inconsistent-parent-tree-mappings-in-a-pdf-created-by-pdfbox still unable to add annotation properly in nums. – fascinating coder May 08 '20 at 03:58
  • /P is the parent. So it should also be somewhere else, and not a new "entire structtree under this" – Tilman Hausherr May 08 '20 at 06:39
  • `Root/StructTreeRoot/ParentTree/Nums/[1]` has three null entries then three real entries, was this intended? – Tilman Hausherr May 08 '20 at 10:36
  • yes, first we auto tagged using adobe and then we added span. – fascinating coder May 08 '20 at 12:27
  • I looked at the "bnd" file. In the "K" tree, the "link" element ( Root/StructTreeRoot/K/K/[1]/K/[1] ) has as kids the annotation OBJR and "span", whose kid is "5". In the page content stream, "/Span << /MCID 5 >> BDC" designates the link text. In the "res_tagged" file, the link element is at Root/StructTreeRoot/K/K/K/[0] , it has as kids OBJR and 0. So the "span" thing is missing, and you've used "/Link << /MCID 0 >> BDC" for the link text. I'm not saying that is the bug, I'm just noticing the difference. – Tilman Hausherr May 09 '20 at 15:52
  • Yes, We know that by adjusting spans also we tried but no result. One quick question Tilman, https://drive.google.com/file/d/1u9BCYSEsfnhYdhAHCnM-W4y4mE5J3peV/view?usp=sharing see I want to create all numdictionaries like a single new obj. How can I do that? – fascinating coder May 09 '20 at 17:11
  • Sorry I don't understand. You could create an object and have the three objects as kids in the /K entry. – Tilman Hausherr May 10 '20 at 09:54

0 Answers0