pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Haddy, Diane E" <diane-ha...@uiowa.edu>
Subject issue creating hyperlink in pdf
Date Wed, 03 Oct 2018 20:27:24 GMT
Hello

I have a task to create a hyperlink on a pdf page.  I googled and found some code.  I am not
good with coordinates and do not know anything about pdfbox PDGamma class and how to add the
color black to the text.   Can you please help me?

CODE:

PDBorderStyleDictionary psd = new PDBorderStyleDictionary();
            psd.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
            PDAnnotationLink txtLink = new PDAnnotationLink();
            txtLink.setBorderStyle(psd);
           // txtLink.setColour(PDGamma  colourBlack);

             //add action
            PDActionURI action = new PDActionURI();
            action.setURI("http://mycode.here.com");
            txtLink.setAction(action);

             //populate the url using these coordinates
            PDRectangle rec = new PDRectangle();
            rec.setLowerLeftX(10);
            rec.setLowerLeftY(20);
            rec.setUpperRightX(100);
            rec.setUpperRightY(10);
            txtLink.setRectangle(rec);
            page.getAnnotations().add(txtLink);


thank you,
Diane



Diane Haddy

Health Care Information Systems
Application Developer


________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications
Privacy Act, 18 U.S.C. 2510-2521 and is intended only for the use of the individual or entity
to which it is addressed, and may contain information that is privileged, confidential, and
exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination,
distribution or copying of this communication is strictly prohibited. If you have received
this communication in error, please notify the sender immediately and delete or destroy all
copies of the original message and attachments thereto. Email sent to or from UI Health Care
may be retained as required by law or regulation. Thank you.
________________________________

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message