How do I check for layers, comemnts and forms in a collection of PDF files?
Dear Lori,
I have a collection of PDF files and need a quick way to check if there are any layers, or comments/markup, or form fields. Can you help?
Lori responds,
From within Acrobat, you can do a visual inspection of your file.
To check for Layers (which are named Optional Content Groups in the PDF format) open the Layers tab or look for a “layered cake” in the Document Status bar (see Figure 1).
Figure 1: Example of file with layers (or OCGs) the “layer cake” is present in the document status bar and layers are visible in the Layers tab.
Comments, form fields, multimedia objects, and links are all considered annotation types and are placed on top of the PDF in the “annotation layer”, which is different than OCG layers described above. A quick way to determine if there are any annotations on a page is to select the “Select Object” tool. If there is any content on the annotation layer it will be highlighted. (See Figure 2)
Figure 2: Choose the Select Object Tool (in the advanced editing toolbar) and select
“Edit > Select All” to see any content on the annotation layer in a PDF document.
Instead of opening each PDF by hand, you could create a small JavaScript to check for OCGs or Annotations and create a report which includes the name of the file and whether any content was found. This could be run as a batch process.var rep = new Report(); rep.size = 1.2; rep.color = color.blue; rep.writeText ("Testing for Content"); rep.writeText("FileName : " + this.documentFileName); for (var i = 0; i < this.numPages; i++ ) // loop thru all pages { var a= this.getAnnots(); var c = this.getOCGs(); var b = this.getPageBox("Crop", i); var l = this.getLinks(i, b); rep.indent(20); rep.writeText("Number of Links on page " + (i+1) +" is " + l.length); if (a != null ) rep.writeText("There are annotations on page " + (i+1)); if (c != null ) rep.writeText("There are layers in this document.") } var docRep = rep.open("myreport.pdf"); Lori
<< Back to Dear Lori main menu.
<< Back to Lori's Corner main menu.









