Comments (8)
Maybe we can take inspiration from this:
- https://github.com/AaronMorais/pdf-highlighter/blob/master/src/pages/index.js#L184-L211
- https://github.com/EvolutionJobs/pdf-viewer/blob/master/pdf-viewer-page.ts
from vue-pdf-embed.
Hi @valh1996,
Do you think updating PDFJS to 2.13.216 would cover the diacritics insensitive search problem (check this PR)? As for "several words to search", I'm not sure how this is supposed to work.
from vue-pdf-embed.
Hi @valh1996,
Do you think updating PDFJS to 2.13.216 would cover the diacritics insensitive search problem (check this PR)? As for "several words to search", I'm not sure how this is supposed to work.
Hi @hrynko,
Yes thanks, I think it would be perfect for the diacritics. However, how to access the pdfFindController
to execute a find
with your package?
I think it should be possible to do it via the ref
making pdfFindController public:
pdfEmbedRef.pdfFindController.executeCommand('find', {
caseSensitive: false,
findPrevious: undefined,
highlightAll: true,
phraseSearch: false,
query: query
});
As for the "several words to search", the problem is that if I run the above find
with the word "Alice", and then re-run it with the word "Alex", then it will overwrite all previous matches with the word "Alice".
But for that, I'm not sure if you can do something at your level. I could for example simply modify this part of the PDF-JS lib with patch-package for exemple.
Therefore, could you please do an update to make access to the find
command? And when a new version with the changes on master will be available (for PDFJS > 2.13.216) ?
EDIT : It looks like we have to go through the eventBus
now to highlight the text instead of executeCommand
. I don't know if you have an example to highlight in this case?
from vue-pdf-embed.
I've tried exposing something like the following, with no success so far:
import { EventBus, PDFFindController } from 'pdfjs-dist/legacy/web/pdf_viewer.js'
...
const findController = new PDFFindController({
eventBus: new EventBus(),
linkService: this.linkService,
})
findController.setDocument(this.document)
I'm not sure if this will work outside of PDFViewer
yet, but if you could continue this experiment, I would appreciate a PR.
from vue-pdf-embed.
I've tried exposing something like the following, with no success so far:
import { EventBus, PDFFindController } from 'pdfjs-dist/legacy/web/pdf_viewer.js' ... const findController = new PDFFindController({ eventBus: new EventBus(), linkService: this.linkService, }) findController.setDocument(this.document)I'm not sure if this will work outside of
PDFViewer
yet, but if you could continue this experiment, I would appreciate a PR.
Yes that's what I tried too, but as you say it can't work without a viewer I think. I tried to ask the question, but it seems that in this case we have to initialize everything manually...
Wouldn't it be easier to refactor using the simple viewer?
What are the advantages of having created the component outside the viewer?
from vue-pdf-embed.
What are the advantages of having created the component outside the viewer?
I expected that not using the viewer component could be more flexible and predictable, although it would have some limitations.
Wouldn't it be easier to refactor using the simple viewer?
It might be, but it would require additional refactoring of the component and could lead to unexpected side effects. So if it can be done without using a viewer, I would do it like this. Otherwise, I would postpone it until the next minor release.
from vue-pdf-embed.
I tried an alternative solution to make the highlight when rendering the textlayer since we get the text with the exact position. But we lose all the advantages of the PDFFindController.
So, after trying several things, I can't get a conclusive result if you can help me on this please?
from vue-pdf-embed.
I'm having issues updating PDFJS, so I'd like to resolve them first. Will have another look at the highlighting issue afterwards.
from vue-pdf-embed.
Related Issues (20)
- vue3 中 pdf 内容错乱 HOT 2
- The requested module 'pdfjs-dist' does not provide an export named 'PasswordResponses' HOT 3
- redundant render base64 pdf cause same canvas render multiple time error HOT 2
- Import font package not found
- Vulnerabilities HOT 1
- xiaomi phone in have this a problem t.a is not a function
- [Bug Report] Memory leaks after changing the page width
- PDF.js Critical Vulnerability HOT 5
- InvalidAccessError: Failed to set the 'responseType' property on 'XMLHttpRequest': The response type cannot be changed for synchronous requests made from a document.
- pdf加载失败 HOT 3
- Page canvases in the wrong order HOT 4
- when I use vue-pdf-embed in my Pad by H5 App,I get a error.How can I solve it??
- images/cursor-editorInk.svg Image loading failed HOT 1
- support zooming gestures HOT 2
- SyntaxError: The requested module '/node_modules/.pnpm/@[email protected][email protected]/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js' does not provide an export named 'toValue' (at index.mjs:20:47) HOT 3
- If it support disableAutoFetch and Rendering Piecewise Loaded PDF Files?
- npm packages deprecations HOT 1
- pdf files have xss and cannot be displayed properly
- [Ask Help]How to set cMapUrl correctly for using useVuePdfEmbed HOT 3
- Print pop-up window display slow.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-pdf-embed.