Copy link to clipboard
Copied
I like to copy text in highlighted passages so they're easier to copy and reference. But when I do that, the comments also include the line breaks, making them harder to read/copy.
Is there anyway (either through Acrobat itself or a javascript code) that can remove the line breaks in the comments?
Note: It's not necessary but it would be great to also select which line breaks are removed. For example, I don't want to remove line breaks follewed by a "-" because I use them for notes.
Ex: "Long quote from" [line break 1] "the PDF that goes over one line" [line break 2]
- notes about the quote I just highlighted
I don't want to remove those line break 2, ones I inserted myself
Copy link to clipboard
Copied
You can do it by running this code from the JS Console:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
annot.contents = annot.contents.replace(/\r([^-])/g, " $1"));
}
}
Copy link to clipboard
Copied
You can do it by running this code from the JS Console:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
annot.contents = annot.contents.replace(/\r([^-])/g, " $1"));
}
}
Copy link to clipboard
Copied
Thanks for the answer! I tried the JS code but I'm getting back an error:
SyntaxError: syntax error
1:Console:Exec
undefinedAny way I can fix this? I don't know much about coding
Thanks!
Copy link to clipboard
Copied
Did you select the full code before running it?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more