How to get exact data which matches regular expression
In pdf ,
I want to Create hyperlink on all numbers with dot (.) (1. , 2. , etc..)
This number will be in the starting of paragraph which has destination with same number with #
Note destination number with # can be on different page
+++++++
Below is the code..
// Iterate through all pages of the PDF
for (var pageNum = 0; pageNum < this.numPages; pageNum++) {
var page = this.getPageNum(pageNum);
var pageText = page.extractText();
// Use a regular expression to find numbers with dots at the beginning of paragraphs
var numberRegex = /^\d+\./gm;
var match;
while ((match = numberRegex.exec(pageText)) !== null) {
// Extract the matched number with dot
var numberWithDot = match[0];
/////////// Hyperlink and hyperlink destination code will come here .....
}
}
++++++
Error
this.getPageNum(pageNum) is not a function
tried alternative,
this.getNthPage(pageNum)
this.getNthPage(pageNum) is not a function
How do I exactly get the content of the page and match it with regex. Please help.
In the indesign script there is a doc.findGrep() function which makes life easier. How do I achieve this in PDF?
Thanks for the support.
