lfoppiano / streamlit-pdf-viewer

Streamlit PDF viewer
https://structure-vision.streamlit.app/
Apache License 2.0
62 stars 3 forks source link

Enable text content #52

Closed lfoppiano closed 1 week ago

lfoppiano commented 1 month ago

This PR enable the textlayer on top of the canvases, with the text layer it's possible to select the text extracted from the PDF (#16). Since the annotations are placed on top of the text layer, when they are very dense, it might be possible that annotations boxes and selection interfere.

This PR also update pdf.js to version 4 (#36) which fixes some vulnerabilities.

image

More information on this PR, in the related issue #16

lfoppiano commented 1 month ago

@t29mato two more questions for you:

  1. should we add a flag to disable the text layers so that user may disable them if they don't need and/or if they are not happy with their interference with the annotations?
  2. do you have any suggestion on the z-index I hardcoded, please do let me know.
t29mato commented 1 month ago
  1. In the latest code, it's not the text layer but the annotations that interfere with text layer selection. So, I think a button to disable annotations might be a good idea. Another idea could be to have a copy menu appear when clicking on annotations, but since annotations don't have text information, that might be tricky.
  2. I think it's fine to leave the hardcoded z-index as it is.