Skip to content

Instantly share code, notes, and snippets.

View xiaoouwang's full-sized avatar
🎯
Focusing

Xiaoou WANG xiaoouwang

🎯
Focusing
View GitHub Profile
@alexschreyer
alexschreyer / extractComments.js
Last active March 12, 2021 15:57
Extract comments from Acrobat PDF
// Get all annotations in current document
var annots = this.getAnnots();
// Assemble them into a Tab-delimited string (remove linebreaks in comments, too)
var cMyC = "Comment\tPage";
for ( var i=0; i<annots.length; i++ )
cMyC += ("\n"+annots[i].contents.replace(/(\r\n|\n|\r)/gm,"")+ "\t" + annots[i].page);
// Export them to MS Excel (opens the data there)
this.createDataObject({cName: "myCommentList.xls", cValue: cMyC});