Print Page | Close Window

Open an Embedded File via Hyperlink

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3778
Printed Date: 07 Jun 25 at 6:51PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Open an Embedded File via Hyperlink
Posted By: ashish.cppdev
Subject: Open an Embedded File via Hyperlink
Date Posted: 27 Jan 20 at 3:16AM
Hi,

I just found out about Quick PDF library today and I have downloaded a trial version. So far, I am loving it, given that version 17 has Qt support as well.

My request is pretty straightforward:

1. I have a main PDF file which is a transcript.
2. Each transcript file has 1 or more exhibits.
3. These exhibits need to be attached to the transcript PDF.
4. Certain keywords in the transcript PDF need to be hyperlinked to open the associated attached (embedded) PDF exhibit file.

So far, using 
AddEmbeddedFile
AddFileAttachment

I am able to attach the exhibit files and the attached files appear as thumbtacks/pins.

Now, I would like to take care of Requirement 4 in my list above. I am not sure if it is possible with Quick PDF library but would appreciate any advice.

Thank you,
Ashish



Replies:
Posted By: Ingo
Date Posted: 27 Jan 20 at 11:39AM
Hi Ashish,

you can add links and you can visualize them with text but not the other way round.
Here's a sample:
https://www.debenu.com/kb/add-links-pdf-programmatically/
There's no comfortable way adding links to existing textcontent.
It's possible to extract all text - word by word with position data - and then you can create a new pdf with all the links repositioning the text.
I fear this won't look very nice ;-)

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: ashish.cppdev
Date Posted: 27 Jan 20 at 4:21PM
Thanks Ingo. I will take your sample code and see how it turns out. I will post my results here as well.

Thanks again for the quick response.


Posted By: ashish.cppdev
Date Posted: 28 Jan 20 at 3:19AM
Hi Ingo,

Thanks for the link and I tried it. It does pose some challenges but I am willing to give it a shot by extracting all of the text and the box coordinates using Quick PDF.

Here is my sample code based on the example you provided a link to:

	int nEmbeddedFileId = dqpdf.AddEmbeddedFile("exhibit1.pdf","application/pdf");
        nRet = dqpdf.AddFileAttachment("Exhibit 1",nEmbeddedFileId);
        nRet = dqpdf.SetOrigin(1);
        nRet = dqpdf.AddLinkToEmbeddedFile(200, 100, 60, 20,nEmbeddedFileId,"Exhibit 1","Exhibit 1",6,50);
	    nRet = dqpdf.SetTextColor(0,0,1);
        nRet = dqpdf.SetTextUnderline(1);
        nRet = dqpdf.DrawTextW(205, 114, "Click me!");

        nRet = dqpdf.SaveToFile("dqpdf.pdf");

I can see that the file does get a Click me! text in blue color with an underline so it can look more like a link, but I have to double click it to open. Is there any way to just click once and get it to open?




Posted By: Ingo
Date Posted: 28 Jan 20 at 11:10AM
Please keep in mind that the embed-functionalities are only supported by the adobe products.
Single click actions aren't supported.
I think this would collide with functions like mark and copy?
What you can do is embed some javascript action to get the described behavior.



-------------
Cheers,
Ingo



Posted By: ashish.cppdev
Date Posted: 28 Jan 20 at 2:17PM
Thanks for the clarification.

When you say javascript action, can you give an example?

Thanks


Posted By: Ingo
Date Posted: 28 Jan 20 at 6:33PM
With QuickPDF you can embed Javascript-code into your pdf and you can assign an action to it.
In the online reference and the developer guide you'll find the functionalities and samples.

The JavaScript-functionalities:
https://www.debenu.com/docs/pdf_library_reference/JavaScript.php
The types you can use:
http://www.adobe.com/devnet/acrobat/javascript.html
Open the developer guide and search with javascript:
http://www.debenu.com/docs/pdf_library_developer_guide/foxit_quick_pdf_library_15_developer_guide.pdf

The start for own searches:
https://www.debenu.com/docs/pdf_library_reference/Search.php




-------------
Cheers,
Ingo



Posted By: ashish.cppdev
Date Posted: 29 Jan 20 at 2:29AM
Thank you very much again! Appreciate it very much. I will start reviewing the material.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk