Product: PDFNet Node
Product Version: 9.4.0
Please give a brief summary of your issue:
Highlight multiple search results
Please describe your issue and provide steps to reproduce it:
I would like to loop through all search result highlights, but it seems only run for the first match.
Here is the code:
const doc = await PDFNet.PDFDoc.createFromFilePath("pdf-demo.pdf");
const txtSearch = await PDFNet.TextSearch.create();
await txtSearch.begin(
doc,
"1234",
PDFNet.TextSearch.Mode.e_whole_word +
PDFNet.TextSearch.Mode.e_page_stop +
PDFNet.TextSearch.Mode.e_highlight
);
const result = await txtSearch.run();
if (result.code === PDFNet.TextSearch.ResultCode.e_found) {
/** @type {PDFNet.Highlights} */
const hlts = result.highlights;
await hlts.begin(doc);
while (await hlts.hasNext()) {
const quadArr = await hlts.getCurrentQuads();
console.log(quadArr);
await hlts.next();
}
}
The pdf file is very simple
pdf-demo.pdf (8.7 KB)
The log only shows 1 result and only run once, whilts I would expect 3 results
[
{
name: 'QuadPoint',
p1x: 104.59599999999999,
p1y: 556.9580000000001,
p2x: 132.596,
p2y: 556.9580000000001,
p3x: 132.596,
p3y: 574.9340000000001,
p4x: 104.59599999999999,
p4y: 574.9340000000001
}
]