Is there a simple way to add a working/clikable url into a pdf, using c++, qt and the qprinter class? To clarify it a little bit: I want to add the url during generating a new document. I’m not trying to edit an existing pdf.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create a PDF with Qprinter using QTextDocument. QTextDocument has setHtml() method which lets you use html tags including
<a>tag (<a href='http://www.google.com'>google</a>). After that, you can create PDF with that HTML using QTextDocument print() method.Code Example:
After running this code you will have out.pdf file with a clickable text: “google” that links to “http://www.google.com”
P.S. You could even add an image using
<img>tag.