-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pdf2htmlEX support #1
base: main
Are you sure you want to change the base?
Conversation
@@ -15,6 +16,10 @@ export function createIntegration(annotator: Annotator): Integration { | |||
return new PDFIntegration(annotator); | |||
} | |||
|
|||
if (isPdf2htmlEX()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I would pass an integration through the hypothesis config object, but this how its currently done for the existing PDF.js integration 🤷🏻♂️
|
||
let page = this._pdfViewer.pages.find(page => { | ||
let xpath = xpathFromNode(page.page, root); | ||
return range?.startContainer.startsWith(xpath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find a better way than an xpath prefix comparison to find the page.
It also means that we're basically only relying on RangeSelector
whereas the other selectors are deemed more performant or robust. Luckily, the DOM of the pdf2HtmlEx output is stable.
bdba276
to
ea9d000
Compare
ea9d000
to
5b5b434
Compare
Summary
A start with pdf2htmlEX support for Hypothes.is
Screenshots
Collapsed
Side-by-side