Recently we found Paul Madary's blog post about digital signatures in a Univeral Application (UWP) with iText 7, and we wanted to share it. Paul gracefully agreed to let us do that, and as a bonus we upgraded the code to be usable out-of-the-box with iText 7.1.3. The only change needed is the method SignDocumentSignature.

A big thank you to our Q3 top contributors!

There are so many people that contribute information to us in order to help improve our code, products and projects. We want to make sure that our top contributors are being recognized for the help they give and that they know how much we appreciate them.

Top menu

Breadcrumb

How to open an MS Word attachment by clicking an image?

How can I make an image clickable so that an attached MS word document opens?

26th November 2015

admin-marketing

I have some PDFs here where there are some images (an MS Word icon with the MS word file name beneath the icon) which open the attached ms word document by clicking on the images. I wonder 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 something like an action (GoToE seems only available for PDF attachments) or a link?

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":

ISO-32000-1, section 12.6.4.4

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).

How To find internal links in a PDF file?

Ready to use iText?

As always, if you have any technical questions, you can contact support with your valid support subscription or head over to one of our community support pages on Stack Overflow to see if your question has already been answered for our AGPL users.