Skip to content

Commit

Permalink
highlight text (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
gecBurton authored Dec 13, 2024
1 parent 46e2e01 commit ec6bda5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/templates/core/document.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
pdf.getPage({{ page_number }}).then(page => {
console.log('Page loaded');

page.getTextContent().then(function(textContent) {
// Loop through text items to find the text you want to highlight
textContent.items.forEach(function(item) {
if (item.str.includes('{{ embedding.text }}')) {
console.log("found!");
} else {
console.log(item + " isnt relevant");
}
});

const scale = 0.5;
const viewport = page.getViewport({
scale
Expand Down

0 comments on commit ec6bda5

Please sign in to comment.