0

I have a pdf with some text.

I would want to tag a text content as a figure and then be able to add an Alt text to it. (I can programmatically add alt text to an element tagged as figure by using Acrobat DC). The pdf looks like something below.

**A sample pdf**

1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, 
sed diam nonum- my nibh euismod ncidunt ut laoreet dolore magna aliquam erat volutpat. 
Ut wisi enim ad minim veniam, quis nostrud exerci taon ullamcorper 
sus- cipit lobors nisl ut aliquip ex ea commodo consequat. 

2. Duis autem vel eum iriure dolor in hendrerit in 
vulputate velit esse molese consequat.

3. vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan 
et iusto odio dignis- sim qui blandit praesent luptatum zzril 
delenit augue duis dolore te feugait nulla facilisi.

In the above example, I have to tag the second paragraph(2. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molese consequat.) as a figure.

SuperNova
  • 15,051
  • 5
  • 67
  • 45
  • have you tried addapting the proposed solution under https://stackoverflow.com/questions/34036200/add-alternative-text-for-an-image-in-tagged-pdf-pdf-ua-using-itext to your case? – André Lemos Feb 19 '19 at 08:40
  • yes @AndréLemos, I am able to add alt text to a figure. But I want to tag a text as figure. – SuperNova Feb 19 '19 at 08:41
  • can you add more details? text should be read as text. why should text be seen as an image and then add alt text to the image? – slugolicious Feb 19 '19 at 18:11
  • i was able to go into the tag tree for the , went to the second
  • and changed the to a
    and set the alt text and it worked. the list still had 3 items but the second items was an image with alt text
  • – slugolicious Feb 19 '19 at 18:24
  • @slugolicious, thanks for the info. Did you do using itextpdf or pdfbox? Could you please share the solution as well? thanks – SuperNova Feb 20 '19 at 12:00
  • I tried using itextpdf, I was successfully able to add alt text to a figure. And I was able to create a tagged pdf (with figures) from scratch. But there is no help out there to add tags to an existing pdf. – SuperNova Feb 20 '19 at 12:02
  • i just used adobe acrobat to edit the file. i went to view > show/hide > navigation panes > tags to see the tags then changed the
  • to a
    directly in the tag tree
  • – slugolicious Feb 20 '19 at 22:14