PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

MigraDoc TOC incorrect hyperlinks
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2882
Page 1 of 1

Author:  Chion [ Tue Aug 05, 2014 11:18 am ]
Post subject:  MigraDoc TOC incorrect hyperlinks

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?

Author:  Thomas Hoevel [ Tue Aug 05, 2014 11:55 am ]
Post subject:  Re: MigraDoc TOC incorrect hyperlinks

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.

Author:  Chion [ Tue Aug 05, 2014 12:20 pm ]
Post subject:  Re: MigraDoc TOC incorrect hyperlinks

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.

Author:  Thomas Hoevel [ Tue Aug 05, 2014 12:27 pm ]
Post subject:  Re: MigraDoc TOC incorrect hyperlinks

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.

Author:  Chion [ Tue Aug 05, 2014 12:46 pm ]
Post subject:  Re: MigraDoc TOC incorrect hyperlinks

Setting it to 0 worked, thanks for the help!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/