PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Jul 15, 2024 11:16 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Aug 05, 2014 11:18 am 
Offline

Joined: Tue Aug 05, 2014 10:45 am
Posts: 3
Hello,

I am currently working on a document where the front page is made using PDFsharp and the remaining pages using MigraDoc. Ideally, I would like the page numbering to start on the second page, so the front page is not counted. I managed to get this working by separating the front page from the remaining MigraDoc document, but now the MigraDoc generated TOC is not working correctly.

Basically, the hyperlink for page 1 points to the first page in the whole document. However, because the front page is not counted in the numbering, page 1 is actually the second page. Therefore, while the numbering is correct, clicking on the hyperlink takes you to the page before the one you want to go to.

Since I don't really need the hyperlinks, I was wondering if it is possible to automatically generate the TOC without them? Or is there some other way of getting the page numbering like this without messing up the hyperlinks?


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 05, 2014 11:55 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!

Why don't you include an empty front page in your MigraDoc document?
Later on you can use PDFsharp to add contents to that page - and all links will be correct.

You create the TOC yourself and you can easily create a TOC without links. That would be another way to solve the issue.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 05, 2014 12:20 pm 
Offline

Joined: Tue Aug 05, 2014 10:45 am
Posts: 3
Thanks for the quick answer!

I did have an empty page before, but then the numbering would start at 2 instead of 1. Or is there a way to adjust at which number it starts counting?

Creating the TOC myself is another option, of course, but I'm looking for the least time consuming options first.


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 05, 2014 12:27 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
You can set the starting page for every section. Default is 1. Maybe 0 will work (I think it should work).
Try "section.PageSetup.StartingNumber = 0".

Alternatively, create a section for the front page. Create another section for the rest and set the starting page to 1 for this section.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 05, 2014 12:46 pm 
Offline

Joined: Tue Aug 05, 2014 10:45 am
Posts: 3
Setting it to 0 worked, thanks for the help!


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

All times are UTC


Who is online

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