Hello,
I am currently using the pdf.spans.manual recipe to annotate a PDF document. I have successfully implemented the focus option to walk through individual text blocks for annotation. However, I would like to enhance the user experience by allowing users to click directly on the PDF image and be redirected to the corresponding text block for annotation.
Do you know how I can modify the existing pdf.spans.manual recipe to implement clickable areas on the PDF that link to specific text blocks?
Any insights or guidance from the community would be greatly appreciated!
Thank you!
Welcome and thanks for the suggestion! I can definitely see the use case for it and it actually just gave me an idea I want to explore further.
We're always looking for ways we can expose these feature ideas as more general-purpose user-facing APIs that can support a range of use cases (because every use case is different and there's so much people might want to do). So I want to experiment with having the image interface (that is used for bounding boxes etc.) support an optional event hook callback that can modify the current task when you click on a bounding box. This is similar to how the new --edit-text feature works in the span interfaces under the hood: https://prodi.gy/docs/named-entity-recognition#edit-text
So in this case, the JSON data could include all layout spans as text and bounding boxes, and clicking on a bounding box would make the respective text the main example text to annotate. But the event hook could also be used to implement other functionality, like focusing on a specific area of an image, OCR-ing a specific section etc.
I'll try this out and will keep you updated if it works!
Okay, first update on my experiment: the rough idea works There are still some open questions around how the underlying data should be structured and saved but it's looking promising. What happens when you click a bounding box can be customised in code via the click_bounding_boxevent hook, so it can be applied to all kinds of use cases.
Thank you for the update and insights! What you demonstrated in the video is exactly what I was looking to implement!
I'm trying to achieve the same functionality, but I cannot find the click_bounding_box event hook. Has it already been developed, and if so, where can I find it? Alternatively, should I create my own event hook and it into my recipe?