We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How can I edit the document Role Map?

I’m trying to modify a tagged pdf to improve PDF/UA conformance. Our documents have a number of tables which are used for layout control, and even though we’ve added AltText to the tables, they still fail the Table Summary check in the Adobe Accessibility Checker.

I can fix this manually by re-tagging the Table with a custom tag, and then using Adobe to edit the document Role Map to change “/LayoutGrid /Table” to “/LayoutGrid /Span”.

In Aspose.PDF, I can change the Table tags to “LayoutGrid” by using the SetTag(“LayoutGrid”) method, but I can find no way to change the Role Map.

Is there any way to either modifiy the Role Map or set the desired mapping for a custom, non-standard tag? Or change the type of LogicalStructure (from LogicalStructure.TableElement to LogicalStructure.SpanElement)?


Could you please attach your input and expected output PDF files here for our reference? We will then provide you more information on it.

table re-mapped manually.pdf (130.4 KB)
table re-tagged.pdf (128.4 KB)
table start.pdf (129.6 KB)

Please see the three attached files.

“table start” is the initial input file, and has a table with the original “Table” tags. I run a short program on it to produce “table re-tagged”, which finds all of the LogicalStructure.TableElement and does a .SetTag() to “LayoutGrid” (or LayoutTH, LayoutTR, or LayoutTD, as appropriate.) At this point there’s a Role Map created in the pdf.

I then open “table re-tagged” in Adobe Acrobat Pro, display the Tags pane, right-click on the top-level tag and select Edit Role Map…, then I expand the “Document Roles”, and select each in turn and change the mapping to Span. The result is saved in the “table re-mapped manually” file. This is the step I want to do programmatically.

The goal is to change the TableElements to SpanElements in order to essentially bypass the Table Summary compliance check for non-data tables. We have Alt Text associated with the tables, but the Adobe compliance check doesn’t recognize this unless you rebuild the table manually in Adobe.

Thank you for your help.


Unfortunately, Aspose.PDF does not support this feature. We have logged a ticket in our issue tracking system as PDFNET-51378 for this requiremnt. We will inform you via this forum thread once there is an update available on it. We apologize for your inconvenience.

Please share sample application (source code without compilation errors) that you used to generate this PDF file. We will update the ticket according to your code.

This is the VB.NET (.NET 4.6.2 Framework) subroutine from my testbed:

Sub PDFTableTagger(inputFileLocation As String, outputFileLocation As String)

Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document(inputFileLocation)
Dim taggedContent As Aspose.Pdf.Tagged.ITaggedContent = doc.TaggedContent
Dim tagRoot As Aspose.Pdf.LogicalStructure.StructureElement = taggedContent.RootElement

For Each kid As LogicalStructure.TableElement In tagRoot.FindElements(Of LogicalStructure.TableElement)(True) ' recursive, but shouldn't need it 
For Each kid As LogicalStructure.TableTHElement In tagRoot.FindElements(Of LogicalStructure.TableTHElement)(True) ' recursive, but shouldn't need it 
For Each kid As LogicalStructure.TableTRElement In tagRoot.FindElements(Of LogicalStructure.TableTRElement)(True) ' recursive, but shouldn't need it 
For Each kid As LogicalStructure.TableTDElement In tagRoot.FindElements(Of LogicalStructure.TableTDElement)(True) ' recursive, but shouldn't need it 

' Change the Role mapping for the four LayoutX above to Span


End Sub


Thanks for sharing the code example. We will inform you via this forum thread once there is an update available on PDFNET-51378.