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?
I hope you're doing well! I wanted to follow up on my previous message to @Ines regarding the click_bounding_box event hook. The functionality shown in the video was exactly what I was looking to implement, but I haven't received a response yet. It seems @Ines might not be active on support at the moment.
I noticed you've been active in the support discussions recently, and I thought you might have insights on this topic. Could you help me out? Specifically, I’m trying to find out if the click_bounding_box event hook has already been developed and where I might locate it. If it hasn't been created yet, would you recommend that I develop my own event hook for my recipe?
Hi @sankrim, sorry for only getting back now! And yes, what I showed in my post was a early concept draft and idea for how it could work to get feedback on whether this is what you were looking for – it's not yet implemented.
We can ship the event hooks, but there is still an open quesition around how it works in the recipe – e.g. in order to make it work like this, the current task content will have to be replaced with the bounding box content, and then the final spans have to be collected somewhere else. It does roughly work, though, so I'm happy to share the implementation once it's ready and you can go and adjust it from there.
If you have any draft code or initial implementation details available, I would love to take a look at it. Having that would really help me get started on my end while we work towards the final version.
I hope you're doing well! I wanted to follow up on my last post regarding the event hooks and the implementation details. If you have any draft code or initial implementation ready, I would greatly appreciate the opportunity to review it and add to it. This would be incredibly helpful as I continue to work on my project.
Thank you for your support, and I look forward to hearing from you!