Add the new tab page on navigation pannel

My goal is to add the new tabpage on the navigation pannel. I searched the forum for creating customer navigation. I used the PDViewCS_2008 as my test project. I declared the CUSTOM_NAV in PDFViewForm.cs. When the project run, I got the error, “system.NullReferenceException: Object reference not set to an instance of an object.\r\n at PDFViewCS.PDFViewForm.OpenPDF(String filename)” on the code, bookmark_tree.BeginUpdate().

My questions:

  1. Do I miss anything that made me to have this error. If so, would you tell me what I miss.

  2. Would you tell me what should do to add a new tabpage on the navigation. I also need the book mark and layer panel as like the build-in pannel on the sample.

The following is the code snippet for on PDFViewForm.cs file in PDViewCS_2008 project.

#if CUSTOM_NAV

// Populates a custom bookmark tree control with bookmark nodes (if any).

Bookmark root = _pdfdoc.GetFirstBookmark();

if (root.IsValid())

{

bookmark_tree.BeginUpdate();

BuildBookmarkTree(root, bookmark_tree.Nodes);

bookmark_tree.EndUpdate();

}

else

{

// Optional: Uncomment the following line to hide the bookmark

// tab if the document does not containing bookmarks?:

// _pdfdoc_tab.Hide();

}

Thanks in advance.

You need to define CUSTOM_NAV on the project level.
Open PDFViewCS solution project. Click Project > Properties. Under Build > General > Conditional compilation symbols add CUSTOM_NAV (e.g. NET_1_1; CUSTOM_NAV).

Alternatively search all the places in the code and remove ‘CUSTOM_NAV’ blocks that surround the code.

You may need to clear some ambiguities in the code (e.g. rename Action to pdftron.PDF.Action) but that is it.