PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Fri Apr 03, 2026 11:30 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat Apr 11, 2009 6:36 am 
Offline

Joined: Fri Apr 10, 2009 12:00 pm
Posts: 1
I have used the following codes, but it does work:

string filename = "Bookmarks.pdf";
PdfDocument document = PdfReader.Open(filename, PdfDocumentOpenMode.Modify);

PdfOutline.PdfOutlineCollection outlines = document.Outlines;

Console.Writeline(outlines.Count);

The outlines.Count always return 0.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 13, 2009 9:00 pm 
Offline

Joined: Wed May 13, 2009 3:11 pm
Posts: 1
I did pretty much the same thing. Ran the Bookmarks example and then used the output file to try to read in the outlines in order to split the file. But I'm getting a count of 0 (zero) as well.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 04, 2009 5:30 am 
Offline

Joined: Sun Oct 04, 2009 5:14 am
Posts: 1
I got the same kind of error.
Open an existing PDF that has outlines and the PdfDocument.Outlines.Count is zero.
My guess is the PdfDocument.Outlines only knows the outlines during the PDF creation. During the PDF import the Outlines property do not get populated. If this is true then PdfSharp documentation is very very poor.
To access the Outlines of the PdfDocument, use the following:
PdfDocument.Internals.Catalog.Elements.GetObject("/Outlines") and cast the output object to PdfOutline.
To access the title of the outline use PdfOutline.Elements.GetString("/Title")

(PS: these can be found in the source code of the project PdfMerge).


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 4:59 pm 
Offline

Joined: Thu Dec 03, 2009 1:48 pm
Posts: 2
Hello,
i also have the same problem.

i use pdfsharp for concatenation of pdf. Therefore i also want to migrate the old bookmarks.
Therefore i have to read the old ones ...

is there a possibillity to insert cascading bookmarks ?
Something like
Point1
|-Point1.1
|-Point1.2
Point2
|-Point2.1
|-Point2.2

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 07, 2009 12:49 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3144
Location: Cologne, Germany
Jeb wrote:
is there a possibillity to insert cascading bookmarks?

Yes.

The PdfOutline object contains Outlines. This allows to create a tree of Outlines.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 07, 2009 2:18 pm 
Offline

Joined: Thu Dec 03, 2009 1:48 pm
Posts: 2
Thanks for that hint.
But my main Problem ist to read the existing outlines of an PDF.
As far as i see, the pdfdocument object doesnt read the outlines...


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 07, 2009 2:40 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3144
Location: Cologne, Germany
Jeb wrote:
As far as i see, the pdfdocument object doesnt read the outlines...

Not my area of expertise, but I guess bun_zee's post shows how to do that.
viewtopic.php?p=2314#p2314

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 959 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