Skip to content

PdfDocumentOutlineView.BeforeOutlineItemAdd Event

Gets or sets the event that is fired when an outline item is about to be 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.

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