PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to get a pdf document outlines

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
jiuqiangjiang



Joined: 30 Mar 2007
Posts: 1

PostPosted: Sat Mar 31, 2007 3:02 am    Post subject: how to get a pdf document outlines Reply with quote

I want to get outlines from a exist document and I write code like
this:
PdfDocument pdfFile = PdfReader.Open(@"C:\Downloads\pdf_reference.pdf", PdfDocumentOpenMode.Import);
PdfOutline.PdfOutlineCollection outlineCollection = pdfFile.Outlines;
foreach (PdfOutline outline in outlineCollection)
{
System.Console.WriteLine(outline.Title);
}

and then raise a error :
no appropriate constructor fond for type:PdfOutline

now,how can I solve my problem?
thanks!
_________________
study..........
Back to top
View user's profile Send private message MSN Messenger
IQDragon



Joined: 11 Jul 2007
Posts: 1

PostPosted: Wed Jul 11, 2007 1:06 pm    Post subject: Outlines Reply with quote

This is correct, to my knowledge a lot of stuff won't work with existing PDF documents.

I downloaded the 0.9.653 code myself (only can use .NET 1.1 for this project) and found that error to.

The trick is to have the following constructor:

public PdfOutline(PdfDictionary dictionary) : base(dictionary)
{
}

This does not fix the issue with existing outlines, you'll soon notice it retuning an empty collection.

If you need a fix for this let me know I'll be happy to share it.
It did take considerable time to find a workaround though lol.
Back to top
View user's profile Send private message
ACS



Joined: 01 Dec 2007
Posts: 15

PostPosted: Tue Dec 04, 2007 5:41 am    Post subject: Reply with quote

I'm actually looking for a fix for this as well. I need to access the outline structure of an existing PDF and it's very frustrating that I can't do it! Sad

IQDragon, if you have a fix, please share!
Back to top
View user's profile Send private message
cvanling



Joined: 11 Jan 2008
Posts: 5

PostPosted: Sun Feb 17, 2008 7:23 pm    Post subject: Outlines Reply with quote

It can be done using PdfSharp, but a little coding is required.

First you need to access the document outline:

// get the outline object
PdfDictionary outline = (PdfDictionary)inputDocument.Internals.Catalog.Elements.GetObject("/Outlines");

// you can then access the first outline using:
PdfDictionary first = (PdfDictionary)outline.Elements.GetObject("/First");

// you can then access the title of the first outline using:
string title = first.Elements.GetString("/Title");

There is a fully worked out demo for this on sourceforge (see the pdfmerge project). It gets a little complicated because there are lot of variations in outline formats, especially for new acrobat documents which support outlining to various points on a single page.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com