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

Paragraph Bookmark
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1877
Page 1 of 1

Author:  mcartur [ Sat Dec 31, 2011 5:34 pm ]
Post subject:  Paragraph Bookmark

Hi I am new to migradoc and pdfsharp,

the issue is that I can not get rid of the bookmarks that are automatically created when adding a paragraph like this:
Paragraph inicio = document.LastSection.AddParagraph();
inicio.Style = "Heading1";
inicio.AddSpace(110);
inicio.AddText("Factura nº");

I do not know how to get the pdf with no bookmarks.

Any solution to this issue will be great¡ (I have only seen questions about the creation of bookmarks but not to the removal of them...)

Thanks¡

Author:  () => true [ Sat Dec 31, 2011 6:40 pm ]
Post subject:  Re: Paragraph Bookmark

Bookmarks are created for paragraphs that have the OutlineLevel set (i.e. the predefined Heading styles).
If you create own styles, they won't have bookmark entries created automatically.

Or you can clear the OutlineLevel for individual paragraphs or for all Heading styles.

Here is sample code that creates a bookmark for a paragraph:
Code:
    paragraph = sectionToc.AddParagraph();
    paragraph.Format.OutlineLevel = OutlineLevel.Level2;


Set the OutlineLevel to BodyText to avoid bookmarks for headings:
Code:
    paragraph = sectionToc.AddParagraph();
    paragraph.Format.OutlineLevel = OutlineLevel.BodyText;

Better create a new style (e.g. "Heading1WithoutBookmark") and set the OutlineLevel for this style (to avoid setting it for every single paragraph).

Author:  mcartur [ Sun Jan 01, 2012 12:51 pm ]
Post subject:  Re: Paragraph Bookmark

Thank you, your:
style.ParagraphFormat.OutlineLevel = OutlineLevel.BodyText;
was the solution¡

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