mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.54k stars 543 forks source link

[FEATURE] Add support for Tagged PDFs #2046

Open wbittlehsl opened 2 years ago

wbittlehsl commented 2 years ago

Is your feature request related to a problem? Please describe.

I want to produce a tagged PDF document. A tagged PDF document is a document who contains "tags", also called bookmarks, which is an accessibility feature (see image below). When the PDF is read in a compliant reader, there's a UI that allows the user to jump to the tagged locations in the PDF.

Describe the solution you'd like

A solution that supports what the native Skia library supports. I tried to review the Skia code and found the following commit from 2018. It contains a test as well that describes the usage of the feature. In particular, the PDFTag, SkPDF::Metadata.fStructureElementTreeRoot and SkPDF::SetNodeId were the key pieces. I think an identical structure in SkiaSharp would be a great starting point.

On top of the basic functionality, it would be amazing if there was an option to auto-generate the tags based on the document links already provided in the document rather than manually building it.

Describe alternatives you've considered

I didn't see a way to do this with the current APIs so I do not believe there's a work around. You can build document links and generate a TOC for example, but if you want links to all elements of a large PDF, the TOC becomes huge. It would be better to have a high-level TOC and a fully linked bookmark tree.

Additional context

For example:

image

mattleibow commented 2 years ago

Looking at the API, it appears fairly straight forward.

wbittlehsl commented 2 years ago

@mattleibow That's very promising! Thanks for the reply. Any estimate for when this might get implemented/released? I have a project that's looking for this feature to replace existing aging technology.

Thanks!

JSR33 commented 2 years ago

Hi @mattleibow I see that you changed this feature to "planning". Can you advance with a more precise date? As @wbittlehsl I need (a lot) this feature to be implemented.

Simona25 commented 1 year ago

Any news for a release date? This library seems promising but i won't be able to use it if it has no accessibility features :(

mattleibow commented 6 months ago

Initial builds are here! See https://github.com/mono/SkiaSharp/pull/2865#issuecomment-2121754269

Let me know if this is working as expected.

lol768 commented 4 weeks ago

@mattleibow Would it be possible for you to re-publish the package builds? I currently get this:

image

(Not sure if there's a MyGet or "non-public"/experimental NuGet feed instead?)

I'd be interested in playing with this.