Adding tags to image #967
Replies: 8 comments 12 replies
-
As you describe it, this is not supported in neither MuPDF nor in PyMuPDF. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I did understand stand already! Are you telling me, that somewhere in your PDF those XML data are hidden? |
Beta Was this translation helpful? Give feedback.
-
We are back to start here: Where must these data be stored in a PDF?! Storing them just somehow won't help. |
Beta Was this translation helpful? Give feedback.
-
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))
# done Function Several IFs which only you can clarify ... |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
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). |
Beta Was this translation helpful? Give feedback.
-
I have done a lot using this package and I greatly appreciate your efforts. I want to add some
alt
text 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.
Beta Was this translation helpful? Give feedback.
All reactions