简体   繁体   中英

Extract PDF labels to a CSV file using JavaScript

I would like to extract the page labels of a PDF into a CSV file, however at the moment what I have is only a for loop that shows the labels in the Adobe Acrobat javascript console.

The code is:

var labels = this.getPageLabel(0);
for (var i=1; i<this.numPages; i++)
    labels += ", " + this.getPageLabel(i);
    console.println(labels);

Is there a way to export the results from the console to a csv file or another method that would create a csv file with the expected results? Thanks!

Sure, this is possible.

You would create a Data Object, and then export it. The contents of that Data Object is your labels string. For syntax and additional information, see Acrobat JavaScript documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM