hlib icon indicating copy to clipboard operation
hlib copied to clipboard

add pdf support

Open judell opened this issue 1 year ago • 0 comments

Title: Add Support for PDF Files in hlib Objective: The goal is to extend hlib to support PDF files. This would allow annotations to be created, retrieved, updated, and displayed in PDF documents rendered in the browser's DOM using PDF.js. Approach:

  • PDF Parsing: Use PDF.js to render PDF files into the browser's DOM.
  • Annotation Anchoring: Extend hlib functions to handle PDF-specific cases. This includes storing the page number along with the annotation when it's created.
  • Page Navigation: Implement a function to navigate to a specific page in the PDF document. This would be used when an annotation is retrieved, to ensure it's displayed on the correct page.
  • Lazy Loading Handling: Ensure that the page is fully loaded before trying to anchor the annotation. This is necessary because PDF.js uses lazy loading. Challenges:
  • Handling text selection across multiple pages.
  • Ensuring annotations are correctly displayed when a page is not yet loaded due to lazy loading.
  • Maintaining compatibility with existing hlib functions. Examples:
  • Annotating a PDF document and then retrieving and displaying those annotations.
  • Navigating to a specific page in a PDF document to display an annotation. Impact:
  • Expanding the use of hlib to a wider range of documents.
  • Improving the user experience for annotating PDFs.

judell avatar Nov 07 '23 02:11 judell