Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed May 27, 2015 8:21 am

Hi, I am trying to add multiple links to a pdf but having some trouble. First link works fine and works, subsequent links also work but are placed on top of each other. The code to create the links is in a function with paramater passed in. The problem is Result (see code below), even though being set to Nothing on each function call adds new FindText results to Result as an array and the Find.Position and Find.Size are pointing to element(0) only so x,y,h and w are all the same for each link. I cannot figure out how to point to the other elements in the array. Does anyone know how to get around this?


Thanks

Tom

Dim Result As PdfTextFind() = Nothing
Result = PDFDocument.Pages(LinkHome).FindText(LinkText.ToString).Finds()

For Each find As PdfTextFind In Result
find.ApplyHighLight()

'Get the coordinates of the text found
x = find.Position.X
y = find.Position.Y
h = find.Size.Height
w = find.Size.Width

Tom Pettit
 
Posts: 2
Joined: Sat May 23, 2015 1:01 pm

Wed May 27, 2015 9:41 am

Hello,

Thanks for your inquiry.
Could you please send us your sample pdf file and your sample code? Please package your sample file into ZIP file format. Then, upload your zip file. It would be helpful to replicate the issue and work out the solution for you ASAP.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Wed May 27, 2015 11:25 am

I will need to create a sanitized version as it is sensitive information. However I can describe it for now if that helps.

The PDF is in excess of 1000 pages long and is a series of reports created and compiled in MS Access and combined into a s single PDF. At the start it has an a-z index spanning 30 pages of location names with each to be a link to the relevant page somewhere in the PDF. I have a table of contents I built in access so I know where each and every page is. I am using VB.NET to create these links as Access cannot. I have the main routines working pulling in the TOC and the links are being created and pointing to the correct pages but they are all created in the one location and size on the index pages, because I can only access x,y,h and w from the first Result as in the code above.

I set Results to Nothing on each pass but for some reason, on each pass, all previous searches are included as in an array (0), (1),(2),.... but I can only refer to (0), hence everything being same size and location and pile on top of each other.

Cheers

Tom

Tom Pettit
 
Posts: 2
Joined: Sat May 23, 2015 1:01 pm

Thu May 28, 2015 6:17 am

Hello,

Thanks for your response.
But it's difficult to say what the issue is without document or complete codes . Could you please supply a simplified application demonstrates the issue you encountered.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF