Closed t29mato closed 6 months ago
@lfoppiano
Code still needs refactoring, but I think the functionality has been implemented to use it as demonstration.
is it possible to add two more methods:
set_annotations(annotations=[])
: set the annotations and draw them on the PDF
clear_annotations()
: remove the annotations from the pdf
Another point, every time we create a new pdf_viewer(), a new pdf object is added, we might need to deal with it later.
The annotation are working here, but I cannot see them when integrated into a streamlit app https://github.com/lfoppiano/document-qa.
You can reproduce it as follow:
add-pdf-viewer
of https://github.com/lfoppiano/document-qachunk size
to -1I've created a new project to test the integration of this component into a streamlit application. It should be much easier for you to test than with document-qa
: https://github.com/lfoppiano/pdf-struct/
You should have received an invitation to join.
Don't forget to
pip install -e git+https://github.com/lfoppiano/streamlit-pdf-viewer
After running pip -r requirements
OK. I managed to understand what I did wrong. I forgot to rebuild the frontend. After rebuilding the annotations are pushed to the frontend, but, something is happening and even with 24 annotations, the browser crashes...
The issue happens when no width and height are passed. Can you calculate them from the javascript part?
https://github.com/lfoppiano/streamlit-pdf-viewer/issues/3