PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 10:01 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jun 05, 2009 4:45 pm 
Offline

Joined: Fri Jun 05, 2009 3:52 pm
Posts: 1
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2009 8:15 pm 
Offline

Joined: Thu Jul 02, 2009 8:13 pm
Posts: 5
Wow I have been trying to figure this out for 3 days now. Any help would be awesome.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 07, 2009 3:54 pm 
Offline

Joined: Thu Jul 02, 2009 8:13 pm
Posts: 5
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 446 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group