Adding tags to image #967
Replies: 8 comments 12 replies
|
As you describe it, this is not supported in neither MuPDF nor in PyMuPDF. |
|
Sorry for the late response, @JorjMcKie if you download given PDF file you can see that it talks about Link: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/access.pdf |
|
These references only talk about how to interface with Adobe Acrobat components. This has nothing to do with general PDF access and hence is unusable for PyMuPDF, too. So what I need you to tell me is something like: "Here is a string containing something. Put it in a PDF page / image / whatever ... object using key |
I did understand stand already! Are you telling me, that somewhere in your PDF those XML data are hidden? |
We are back to start here: Where must these data be stored in a PDF?! Storing them just somehow won't help. |
Look, once again: The questions are:
You are the one who must answer those questions. # xref is the image's cross reference number
# 'mathml' is the string containing the MathML source
# then:
doc.xref_set_key(xref, "MathML", fitz.getPDFstr(mathml))
# doneFunction Several IFs which only you can clarify ... |
|
I wonder has there been any progress on this? It's something I'm also interested in, specifically in relation to adding alt text for images in PDFs. I tried the following: but it doesn't seem to work as I was hoping. It does set the key but it doesn't show as alt text when you view the pdf inside Acrobat Reader or similar. The PDF file attached is a sample file that contains alt tags on the images which show in Acrobat Reader, e.g. Any suggestions as to whether this is possible with pymypdf? |
|
The alt text for image (or other content) is part of the official spec of PDF 1.7 (ISO 32000) It should be in the Logical Structure in the trailer (the /StructTreeRoot key). |


Uh oh!
There was an error while loading. Please reload this page.
I have done a lot using this package and I greatly appreciate your efforts. I want to add some
alttext to an image. This text will be a MathML string so when any screen reader encounters an image it will check whether its has some MathML data and if yes then screen reader will read the mathematical equation.Which API end-point should I use to achieve this. Thanks.
All reactions