BookmarksOutlineLevelCollection.Contains

BookmarksOutlineLevelCollection Contains method. Determines whether the collection contains a bookmark with the given name.

BookmarksOutlineLevelCollection.Contains method

Determines whether the collection contains a bookmark with the given name.

public bool Contains(string name)
ParameterTypeDescription
nameStringCase-insensitive name of the bookmark to locate.

Return Value

true if item is found in the collection; otherwise, false.

Examples

Shows how to configure bookmarks outline levels.

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Configure exporting bookmarks in document header/footer
pdfSaveOptions.HeaderFooterBookmarksExportMode = HeaderFooterBookmarksExportMode.None;
// Set default bookmarks outline level
pdfSaveOptions.OutlineOptions.DefaultBookmarksOutlineLevel = 1;
// Specify concrete bookmark outline level.
pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Add("bk3", 2);
pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Add("bk4", 3);
// Remove bookmark
if (pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Contains("bk3"))
    pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Remove("bk3");
// Clear all specified bookmark outline levels.
if (pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Count > 0)
    pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels.Clear();
// Add bookmark back
pdfSaveOptions.OutlineOptions.BookmarksOutlineLevels["bk3"] = 2;
Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "BookmarksOutlineLevel.pdf", pdfSaveOptions)
    .Execute();

See Also