Skip to main content
Participant
November 23, 2021
Question

Script for removing empty <p> accessibility tags for compliance

  • November 23, 2021
  • 2 replies
  • 2357 views

I am converting a large document from Word to PDF and am required to ensure it meetings 508 compliance accessibility requirements. As seen in comments of this post, there are a number of PDF Maker programming issues whereby a number of empty <p> tags are created in tables that need to be manually removed. This is a painstaking process, and I am wondering if anyone has insight into if there would be a way to automatically remove these empty tags using JavaScrip or through another process. I'm only beggining my JS journey and do not yet have the skillset to make this happen, so any advice or insight would be useful! I did find that others have created a script for removing blank pages, but cannot find a way to do this with empty <p> accessibility tags.

 

Any insight would be useful!

This topic has been closed for replies.

2 replies

Bevi Chagnon - PubCom.com
Legend
November 23, 2021

Empty <P> tags aren't really empty.

They usually have invisible content, such as hard returns and spaces...which are real content as far as computer technologies are concerned.

 

You must first artifact the content, and then you can remove the non-empty <P> that remains in the tag tree.

 

@try67 is one of our key scripters in this forum. If he says a script can't do it, then I'd believe him. But there are other scripting wizards in this forum and they might have a solution.

 

|&nbsp;&nbsp;&nbsp;&nbsp;Bevi Chagnon &nbsp;&nbsp;|&nbsp;&nbsp;Designer, Trainer, &amp; Technologist for Accessible Documents ||&nbsp;&nbsp;&nbsp;&nbsp;PubCom |&nbsp;&nbsp;&nbsp;&nbsp;Classes &amp; Books for Accessible InDesign, PDFs &amp; MS Office |
try67
Community Expert
Community Expert
November 23, 2021

A script can't do that.

try67
Community Expert
Community Expert
November 23, 2021

Unless maybe it can be done using the Preflight tool, which can be called using JS...

Participant
December 28, 2021

Follow-up question in a similar vein:

Is there a programmatical way to automatically go through a tag tree and move the contents of each <P> tag up to the enclosing tag, and then delete the <P> tags? See attached screenshot for clarification. Some <P> tags will have more than one item to move. Thank you for any guidance on this. I've got a doc with thousands of table cells to remediate, and I can't help thinking there has to be a way to automate the process.