PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 3:12 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Sep 05, 2010 5:14 pm 
Offline

Joined: Wed Sep 01, 2010 1:41 pm
Posts: 3
Hi

I have a question and I am thankful for you attention

I need to add a bookmark over a multipage pre-existing PDF document.

I will appreciate if it is possible, some sample code

Thanks

Jesus Garcia Aragon


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 4:00 pm 
Offline

Joined: Thu Dec 19, 2013 3:01 pm
Posts: 3
Hello,

Have you had any luck with your project to add bookmarks to an existing PDF file?

I would need to do the same, and I do not understand how : the PDFSharp can handle existing PDFs, but cannot add bookmarks, while MigraDoc can create new documents and add bookmarks to it, but I do not understand how it can use already existing PDFs...

thanks


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 4:08 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
MigraDoc uses PDFsharp, so anything that MigraDoc can do can be done with PDFsharp.

Please look at the Bookmarks sample:
http://www.pdfsharp.net/wiki/Bookmarks-sample.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 7:58 pm 
Offline

Joined: Thu Dec 19, 2013 3:01 pm
Posts: 3
Thank you Thomas,

It worked perfectly and simple, here is the code I used to test:
Sub Main()
Dim document As PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open("HelloWorld.pdf", PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify)

document.Outlines.Add("MyBookmark 2", document.Pages.Item(1))
document.Outlines.Add("MyBookmark 6", document.Pages.Item(5))

Dim filename As String = "HelloWorld.pdf"
document.Save(filename)
End Sub


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 20, 2013 12:44 am 
Offline

Joined: Thu Dec 19, 2013 3:01 pm
Posts: 3
Hello,

I noticed that the above code crashes when HelloWorld.pdf is optimized for fast web load, does any one knows why PdfSharp.Pdf.IO.PdfReader.Open crashes when trying to open PDFs optimized for web?

Is there a work-around for this?


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 20, 2013 4:39 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 339
itacernea wrote:
I noticed that the above code crashes when HelloWorld.pdf is optimized for fast web load, does any one knows why PdfSharp.Pdf.IO.PdfReader.Open crashes when trying to open PDFs optimized for web?
Make sure you save files in a format compatible with Adobe Reader 5.0.

See also:
viewtopic.php?p=5977#p5977

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 144 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