private string GetBookmarkTitle(IntPtr bookmark) { uint length = PdfiumLibrary.FPDFBookmark_GetTitle(bookmark, null, 0); byte[] bytes = new byte[length]; PdfiumLibrary.FPDFBookmark_GetTitle(bookmark, bytes, length); string title = Encoding.Unicode.GetString(bytes); if (title.Length > 0 && title[title.Length - 1] == 0) { title = title.Substring(0, title.Length - 1); } return(title); }