Print Page | Close Window

How do i create a link from an outline? C#

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=3847
Printed Date: 28 Apr 24 at 9:48AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How do i create a link from an outline? C#
Posted By: Sykh
Subject: How do i create a link from an outline? C#
Date Posted: 22 Sep 20 at 12:24PM
Hey again,
so i created an outline on a page (easy) and it got an outline ID, i then create a named destination for that id (returns 1), try to grab the Destination ID from that name (returns 0) and then use it to add a Link which of course doesn't work.

                        linkId = this.getOutlineId(foundMarker[1]);
                        if (linkId > 0)
                        {
                            Console.WriteLine("OutlineId: " + outlineId);
                            if (qp.SetOutlineNamedDestination(linkId, foundMarker[1]) == 1)
                            {
                                Console.WriteLine("Created NamedDestination " + foundMarker[1]);
                            }
                            int destinationId = qp.GetNamedDestination(foundMarker[1]);
                            Console.WriteLine("Destiation " + foundMarker[1] + " ID: " + destinationId);
                            qp.AddLinkToDestination(x, y, width, height, destinationId, 1);
                        }
and the output is
Quote
OutlineId: 1476395014
Created NamedDestination MyPlaceholder
Destiation MyPlaceholder ID: 0

Is this even the way to do it or can i skip named and get straight to an LinkID?

Cheers
Simon



Replies:
Posted By: Sykh
Date Posted: 22 Sep 20 at 2:30PM
I have tried a different approach since i can get the page number of the outline and they are always at the beginning of a page but NewDestination is still 0

int outlinePage = qp.GetOutlinePage(outlineId);
Console.WriteLine("OutlineId: " + outlineId + " on page " + outlinePage);
int destinationId = qp.NewDestination(outlinePage, 0, 7, 0, 200, 0, 0);
Console.WriteLine("Destination " + foundMarker[1] + " ID: " + destinationId);
qp.AddLinkToDestination(x, y, width, height, destinationId, 1);

Output:
Quote
OutlineId: 1476395022 on page 14
Destiation MyPlaceholder ID: 0

So i think there is something in general i don't understand 

Cheers
Simon

Update
Turns out i can skip the destination which i can't get to work anyway, I'm using 
qp.AddLinkToPage(x, y, width, height, outlinePage, 0, 0));
now which is finally working.

Would be interesting tho what went wrong with my destinations, i might need them in the future...



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