How can I make an image clickable so the attached ms word document opens? I have some PDFs here where there are some images (ms word icon with the ms word file name beneath the icon) which open the attached ms word document by clicking on the images and I wondered how can I do this with the iText library. I can add the images and attach the ms word documents but I haven't figured out how I can apply somwthing like an action (GoToE seems only available for PDF attachments) or a link?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Please take a look at section 12.6.4.4 in ISO-32000-1 (that is the PDF specification). That section is titled "Embedded Go-To Actions":
As you've found out, the behavior you describe is by specification. The
GoToE
action is for jumping to and form a PDF file that is embedded in another PDF file. Other document formats aren't supported because.Your only option is to introduce a file attachment annotation instead of an Embedded file along with a GoToE action. See for instance the FileAttachmentAnnot example:
In this example, we create a
PdfAnnotation
and we define a custom appearance for this annotation (instead of the pin or the paperclip symbol). I used an image because that's what you seem to want. Check out the result here (this works with Adobe Reader, but not all PDF viewers support this).