Adding named destinations on a pdf

Hi there,

I have a requirement where I need to add named destinations to an existing pdf. I was able to use the following chunk of code that I found online to add the named destinations

private static void createPdfWithNamedDestinations()
{
Document pdf = new Document();
// Create document with 100 pages
for (int i = 1; i <= 10; i++)
{
Page page = pdf.Pages.Add();
page.AddStamp(new Aspose.Pdf.TextStamp("Page " + i));
// Named destinations for every page
pdf.NamedDestinations.Add(“Page” + i, new XYZExplicitDestination(i, 0, 600, 0.5));
}
for (int i = 1; i <= 10; i++)
{
// Create outlines (two outlines for every page)
OutlineItemCollection item1 = new OutlineItemCollection(pdf.Outlines);
item1.Destination = new NamedDestination(pdf, “Page” + i);
item1.Title = "Page " + i + “(1)”;
pdf.Outlines.Add(item1);

            OutlineItemCollection item2 = new OutlineItemCollection(pdf.Outlines);
            item2.Destination = new NamedDestination(pdf, "Page" + i);
            item2.Title = "Page  " + i + "(2)";
            pdf.Outlines.Add(item2);
        }
        // Let's update on of the named destinations
        pdf.NamedDestinations["Page5"] = new XYZExplicitDestination(5, 0, 100, 2);
        pdf.Save("result.pdf");
    }

However, the issue is, when I open the saved pdf on Adobe Acrobat, I don’t see any nameddestinations created on the named destinations tab.
Attached is the generated pdf from this sample code.

Please help me figure out what I am doing wrong.

Thanks,
Rashmi Dahal
result.pdf (16.1 KB)

@rdahal

Can you please open the attached file at your end and share the screenshot of the destination tab in Adobe Reader? result.pdf (15.0 KB)

@asad.ali

When I open the result.pdf document on Adobe Acrobat, this is what I see(see attached screenshot). The destination tab is completely empty. Not only that, if I keep switching between bookmarks tab and destination tab, the pdf crashes.destinations-tab-on-result-pdf.PNG (11.9 KB)

@rdahal

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55394

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.