private string GetBookmarkTitle(IntPtr bookmark) { uint length = NativePdfiumMethods.FPDF_BookmarkGetTitle(bookmark, null, 0); byte[] buffer = new byte[length]; NativePdfiumMethods.FPDF_BookmarkGetTitle(bookmark, buffer, length); string result = Encoding.Unicode.GetString(buffer); return(result.Substring(0, result.Length - 1)); }