Print Page | Close Window

Check for WebLink in same spot on page

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=3466
Printed Date: 27 Apr 24 at 9:01PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Check for WebLink in same spot on page
Posted By: jjohnston
Subject: Check for WebLink in same spot on page
Date Posted: 22 May 17 at 11:05PM
I'm using the AddLinkToWeb to write annotations into a PDF but I want to make sure that I don't write one if there is already an annotation in that position already.  What is the best way to check to see if there is already an annotation at that position on a page?

Any help is greatly appreciated.



Replies:
Posted By: Ingo
Date Posted: 23 May 17 at 5:22PM
Hi,

you can do something similar like this one:

after a LoadFromFile...

//...

for ipc := 1 to QP.PageCount do
    begin

//...

       for iac := 1 to QP.AnnotationCount do
           begin
              if ( QP.GetAnnotStrProperty(iac, 101) = 'Link' ) or
                 ( QP.GetAnnotStrProperty(iac, 101) = 'LINK' ) Then
                 begin
                    wwwlinks.Text := QP.GetAnnotStrProperty(iac, 111);
                    wwwlinks.Items.Add(Trim(wwwlinks.Text));
                 end;
           end;

//...



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



Posted By: jjohnston
Date Posted: 24 May 17 at 6:46PM
I appreciate your reply but that just gets the link but does not tell me it's position on the page.  
I need to know it's Left, Top, Width, Height to determine if there is already a link in that position.

Is there a way to get the Left, Top, Width, Height of an annotation?



Posted By: Ingo
Date Posted: 24 May 17 at 7:36PM
so you need additionally 
ExtractFilePageText:
http://www.debenu.com/docs/pdf_library_reference/ExtractFilePageText.php
and/or
GetPageText:
http://www.debenu.com/docs/pdf_library_reference/GetPageText.php
Both functions offers options for a csv-extraction for each string with the rectangle coordinates and more.
Now your ideas will spread...
Search the links you've found with the function i've told about already inside the extracted strings and then you have the location.

BTW: Here's the location of the online reference and much more:
http://www.quickpdf.org/



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



Posted By: jjohnston
Date Posted: 24 May 17 at 9:01PM
ahh ok... 

I'm using that GetPageText function to find text that I want to create a link over but I didn't know it would find the text of existing links.  

I will try that.  Thanks.  :)


Posted By: jjohnston
Date Posted: 24 May 17 at 9:14PM
Nope... it doesn't return weblink annotations and their positions in that data.

Was worth a try though.

Any other ideas?


Posted By: Ingo
Date Posted: 24 May 17 at 9:27PM
You can extract all textcontent page by page.
Try different options to extract (the word by word option for example).
If you've a pdf-sample with links for me you upload it anywhere posting the link here... then i'll try by my own.



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



Posted By: jjohnston
Date Posted: 25 May 17 at 5:51AM
Sure...  Here is an example page with a some WebLink Annotations.

http://ge.tt/4NoRWEk2" rel="nofollow - http://ge.tt/4NoRWEk2

There are a few that are overlapping.  I need to be able to determine which ones are over lapping so that I can remove one of them.

I tried just about all combinations of the functions for extracting text with no luck.
It doesn't appear that there is a function for what I need exactly.
I'm still holding out hope though.  :)

I appreciate any help or feedback.


Posted By: Ingo
Date Posted: 25 May 17 at 10:58PM
No chance i fear.
I've checked the file with my own tool.
It telling me that there are more than 15 links on this one pager.
There's no text content - only images. Due to this text extraction isn't possible.
On the page only one link is visible and working.

Perhaps this could be interest for you:
Here Rowan shows how to get all annotations (similar to our earlier post):
http://www.quickpdf.org/forum/find-all-annotations-in-a-pdf_topic1225.html
... and then there's another function "DeleteAnnotation".
So what you could do is to get all annotations, delete them all and set one new.
 


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



Posted By: jjohnston
Date Posted: 26 May 17 at 3:15AM
I appreciate your feedback.  I really need to be able to determine the RECT of the annotation to decide if it needs to be deleted or not.

If you look at the part number 36000-OS on that page you will see that there are two annotations over it. 

I may have to look into another tool.
It's a shame though.  I really love QuickPDF.  I've been using it since iSED owned it.

Thanks again!


Posted By: jjohnston
Date Posted: 26 May 17 at 3:17AM
I use Foxit PhantomPDF to view and edit PDFs manually.  It works pretty great.  
You can see the annotations that I'm talking about with that.


Posted By: prakash.handsome
Date Posted: 01 Jun 17 at 7:17AM
Hi Ingo, 

How to Flip (Mirror Image) an Image in PDF.



Posted By: Ingo
Date Posted: 15 Jun 17 at 2:57PM
Hi Prakash,

not good to post a NEW question into ANOTHER OLD thread ;-)
I can't help and no other will look inside 'cause the thread title doesn't has to do with your question ...


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




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