Book mark on merged pdf

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for .NET (v4)  /  Book mark on merged pdf

DynamicPDF Merger for .NET (v4) Forum

 Apr 02 2012 5:35 AM
Can someone please help me on how we can place a book mark on a merged output pdf via C#.
I'd appended the file using
pdfDocuments.ForEach(documentPdf => document.Append(documentPdf));

Now i need to add bookmark

Requesting your help

Thanks
Santo
 Apr 02 2012 5:55 AM
Posted by a ceTe Software moderator
Hello Santo,

You can add bookmarks to the PDF document without any problem using our DynamicPDF Merger for .NET product. You will need to use the Bookmark page element to do this. You can also use the Outlines class to achieve your requirements. Please refer documentation on bookmarks and outlines at: http://www.DynamicPDF.com/Support/NET_Help_Library_07_03/Outlines%20and%20BookMarks.html.

Thanks,
ceTe Software Support Team.
 Apr 02 2012 8:49 AM
Thanks for the prompt and helpful reply.
Could you please help me on how we could give excel sheetnames as bookmarks
 Apr 02 2012 11:46 AM
Posted by a ceTe Software moderator
Hello,

Our API does not read the excel sheets so you would need to use some other API to read the excel sheet names. Once you have the names of the excel sheets, you could use them to create bookmarks. Just specify the name of the sheet in the bookmark constructor, both the constructors takes a string parameter.

Thanks,
ceTe Software Support Team.
 Apr 03 2012 2:31 AM
Still I was succesful in creating bookmarks but it doesn't work as intended means when clicking on the link it doesn't leads to the corresponding page in the merged document.
 Apr 03 2012 4:44 AM
Posted by a ceTe Software moderator
Hello,

Please make sure that you are adding the bookmark to the respective page to which you want to navigate and this will work for you. Below is the sample code for it.

            FileInfo[] files = new DirectoryInfo(@"F:\temporary\PDFs").GetFiles("*.pdf");
            int pagenumber;
            foreach(FileInfo file in files)
            {
                PdfDocument pdf=new PdfDocument(file.FullName);
                pagenumber= document.Pages.Count ;
                Bookmark bookmark = new Bookmark(file.Name, 0, 0);
                document.Append(pdf);
                document.Pages[pagenumber].Elements.Add(bookmark);
                pagenumber += pdf.Pages.Count;
            }
            document.Draw(@"C:\Mydocumet.pdf");

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:07 AM.