Copy link to clipboard
Copied
Is there a way to print comments only in a continuous fashion, not just one per page? I have many short comments and need to print these out on just a few sheets.
I've looked at a similar question from 2010 with one answer suggesting Java Script, but no link or details, and unfortunately I don't know how to pursue this.
I have tried several possibilities including converting to Word, but this results in individual pages as well. Also, since the PDF page numbers are in a header, it isn't possibly to replace the "section break--new page" with just a line break! I tried using small paper size to print multiple pages on one sheet, but each page shrinks so that it is unreadable. Is there a way to put multiple pages on one sheet without any reduction in the original font size?
Thanks for any help. Using Acrobat X Pro in Windows XP Pro.
Copy link to clipboard
Copied
The best way to do it is by scripting a new PDF Report. Open the JS console (ctrl-J) and clear it, then paste in the following code:
this.syncAnnotScan();
var a = this.getAnnots();
if (a) {
var rep = new Report();
rep.size = 1.8;
rep.color = color.blue;
rep.writeText("Summary of Comments for " + this.documentFileName);
rep.color = color.black;
rep.writeText(" ");
rep.size = 1.2;
rep.writeText("Total of " + a.length + " comments in this file");
rep.writeText(" ");
rep.writeText(" ");
rep.indent(20);
var msg = "\200 page %s by %s on %s";
for (var i = 0; i < a.length; i++) {
rep.writeText(" ");
rep.writeText(util.printf(msg,1 + a.page,a.author,a.creationDate));
rep.indent(20);
rep.writeText(a.contents);
rep.outdent(20);
}
var docReport = rep.open("commentSummary.pdf");
docReport.info.Title = "Comments Summary for " + this.documentFileName;
}
Select it all and press ENTER on your numeric keypad (or ctrl+Return on the main keypad). A new PDF will appear with all your comments in. You can customize the code to set how the Report is laid out, see the Acrobat SDK documentation for what the commands are, but it's relatively simple to work it out from the example above.
You can also drop the code into an Action (using a JavaScript step) and set the Action to run against the current file.
Copy link to clipboard
Copied
Is there a way to print only the pages that have comments. For example, I have a document with 84 pages and have only 32 pages with comments. I need to print only those 32 pages with comments.
Thanks for any help. Using Acrobat X Pro in Windows XP Pro.
Copy link to clipboard
Copied
There's no built-in feature for printing only pages with comments, but you could use JavaScript to implement two different approaches:
1. Loop through the annots array (doc.getAnnots method) and determine which pages (annot.page property) have comments on them. Delete the pages (doc.deletePages method) that do not have any comments (starting from the end of the document) and print the document (doc.print method). This will involve a single print job.
2. Loop through the annots array and determine which pages have comments on them. Print continuous ranges of pages until all of the pages with comments on them have been printed. With Acrobat 11 and later you can use the printRange PrintParams property to specify multiple ranges, so you can get away with a single print job. Otherwise, you'd have issue a print job of each page range.
Copy link to clipboard
Copied
// I made minor changes to the script to better number the pages and skip pages without comments.
app.addMenuItem({
cName: "-",
cParent: "Edit",
cExec: " "
});
// Add a menu item for the comments report function
app.addMenuItem({
cName: "AS_comments_report",
cUser: "Comments Report",
cParent: "Edit",
cExec: "AS_comments_report(this);",
cEnable: "event.rc = app.doc;"
});
AS_comments_report = app.trustedFunction (function (doc) {
if (app.viewerType === "Reader") {
app.beginPriv();
app.alert({
cMsg: "This comment report utility cannot be used with Adobe Reader. It requires Acrobat Pro or Acrobat Standard.",
nIcon: 1, // Warning
cTitle: "Acrobat required"
});
app.endPriv();
return;
}
// Prompt the user for the sorting type
var aSortTypes = [];
aSortTypes.push({cName: "Select a sort type below", bEnabled: false});
aSortTypes.push({cName: "-"});
aSortTypes.push({cName: "None", cReturn: ANSB_None});
aSortTypes.push({cName: "Page #", cReturn: ANSB_Page});
aSortTypes.push({cName: "Author", cReturn: ANSB_Author});
aSortTypes.push({cName: "Date", cReturn: ANSB_ModDate});
aSortTypes.push({cName: "Type", cReturn: ANSB_Type});
var nSortType = app.popUpMenuEx.apply(app, aSortTypes) || ANSB_None;
// Change to true to reverse the sort order
var bReverseOrder = false;
// Specify some page sizes
var PageSize = {
letter_portrait: [0, 11 * 72, 8.5 * 72, 0],
letter_landscape: [0, 8.5 * 72, 11 * 72, 0],
legal_portrait: [0, 14 * 72, 8.5 * 72, 0],
legal_landscape: [0, 8.5 * 72, 14 * 72, 0],
A4_portrait: [0, 11.69 * 72, 8.27 * 72, 0],
A4_landscape: [0, 8.27 * 72, 11.69 * 72, 0]
};
this.syncAnnotScan();
var a = this.getAnnots({nSortBy: nSortType, bReverse: bReverseOrder});
if (a) {
var rep = new Report(PageSize.letter_portrait);
rep.size = 1.8;
rep.color = color.blue;
rep.writeText("Summary of Comments for " + doc.documentFileName);
rep.color = color.black;
rep.writeText(" ");
rep.size = 1.2;
rep.writeText("Total of " + a.length + " comments in this file");
rep.writeText(" ");
rep.writeText(" ");
rep.indent(20);
var msg = "\200 page %s on %s";
for (var i = 0; i < a.length; i++) {
rep.writeText(" ");
if (a[i].contents != null)
{
rep.writeText(util.printf(msg, 1 + a[i].page , util.printd("yyyy/mm/dd", util.scand("yyyy/mm/dd",a.creationDate))));
rep.indent(20);
rep.writeText(a[i].contents);
rep.outdent(20);
}
}
var docReport = rep.open("commentSummary.pdf");
docReport.info.Title = "Comments Summary for " + doc.documentFileName;
}
});
Copy link to clipboard
Copied
The location for the config.js when using the Creative Cloud verion of acrobat (acrobat Pro DC) is
C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts
Copy link to clipboard
Copied
I want to output in a database format for import into MS Access.
I think modifying, in particular, to insert comma's
rep.writeText(util.printf(msg,1+a.page, "," a.author, ...
but I don't know the syntax
Can you help me with that? Maybe include a reference so that I can read on it?
As (somewhat) of an aside - I'm using ie 11 and can't paste into the browser here... had to type the above - how frustrating...
Thanks
Copy link to clipboard
Copied
Thanks, very helpful
Copy link to clipboard
Copied
I see the Correct Answer to this question was posted over 10 years ago.
(And I'm really not competent to follow the instructions.)
Surely in that time Adobe could have come up with a simple "click here" option, to print all comments – or, better still, to convert them to a simple text file!
Copy link to clipboard
Copied
I've now found solution, thanks to Document Geek, at https://community.adobe.com/t5/acrobat-sdk-discussions/print-only-sticky-notes-on-a-single-page/m-p/...