PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Adding bookmark to existing PDF document
https://forum.pdfsharp.net/viewtopic.php?f=2&t=751
Page 1 of 1

Author:  arya [ Fri Jun 05, 2009 4:45 pm ]
Post subject:  Adding bookmark to existing PDF document

Is there anyway, I can add bookmark to an existing pdf document? basically what I wanted to do is, to add bookmark to the first page of existing pdf document. I unsuccessfully tried to play with given bookmark example. Can anyone please provide me with an c# example?
Thank you

Author:  Boy_Narf [ Thu Jul 02, 2009 8:15 pm ]
Post subject:  Re: Adding bookmark to existing PDF document

Wow I have been trying to figure this out for 3 days now. Any help would be awesome.

Author:  Boy_Narf [ Tue Jul 07, 2009 3:54 pm ]
Post subject:  Re: Adding bookmark to existing PDF document

Hello, I figured out the basic way to add a bookmark to an existing PDF.

foreach (string s in selectedFiles)
{
PdfDocument document = PdfReader.Open(s, PdfDocumentOpenMode.Modify);

int count = document.PageCount;
PdfPage page;
for (int idx = 0; idx < count; idx++)
{
page = document.Pages[idx];
document.Outlines.Add("SomeValue", page, true);
}
document.Save(s);
Process.Start(s);

}

basically I'm just adding a bookmark for every page. The "SomeValue" is the title of the bookmark. Basically you will just have add a condition for adding a bookmark. I am still looking into this myself.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/