Skip to content

PdfDocumentOutlineView.BeforeOutlineItemAdd Event

Occurs before an outline item is added to a PDF document.

C#
public EventHandler<PdfVisualOutlineItemAddEventArgs> BeforeOutlineItemAdd;

Event Type

EventHandler<PdfVisualOutlineItemAddEventArgs>

Remarks

This event enables the application logic to decide when a new outline item can be added to a PDF document.

Example

The code below shows how to ask for user confirmation before adding an outline item. The event can also be used to set the title of the new outline item before it is added to the document.

C#
1
2
3
4
5
private void documentOutlineView_BeforeOutlineItemAdd(object sender, PdfVisualOutlineItemAddEventArgs e)
{
    e.VisualOutlineItem.Title = "Enter your outline item title";
    e.AllowAdd = MessageBox.Show($"Are you sure you want to add a new outline item?", "PDF Viewer Demo", MessageBoxButtons.YesNo) == DialogResult.Yes;
}