Add Custom tag variant for arbitrary role-mapped tags#336
Conversation
I'm not sure it's 100% the case right now but in principle we tried to keep pdf-writer types out of the public API so that a pdf writer major bump is not a breaking change in krilla. |
|
That makes sense. I've replaced the |
|
I haven't looked into it yet, would there be a way of reusing our existing codegen infrastructure for this, or is it not possible? In any case, what we do really need is to ensure that the entry of each rolemap maps to a tag that actually exists in the current PDF version. If not, we should probably error out? Or just fallback to |
Currently |
We're using krilla to reconstruct tagged PDFs from parsed input. Real-world PDFs frequently contain application-specific structure tags. Word emits
InlineShape, PowerPoint emitsSlideandTextbox, InDesign emitsStory, etc. These are registered in the source PDF's/RoleMapmapping to standard roles.Without a way to represent arbitrary tags, these all collapse to
NonStructand the original tag names are lost.This adds a
TagKind::Custom(CustomTag)variant that takes an arbitrary name and a standardStructRoleit maps to. krilla writes the custom name as/Sand registers it in the/RoleMap(PDF 1.7) or namespace role map (PDF 2.0).Usage:
Also re-exports
StructRolefromkrilla::taggingso consumers don't need a directpdf-writerdependency.