Example #1
0
 private void method_22(List <BookmarkLevel> A_0, PdfBookmark A_1)
 {
     if (A_0.Count > 0)
     {
         if (A_1 == null)
         {
             A_1 = this.pdfNewDocument_0.get_Bookmarks().Add(this.method_1().WordBookmarksTitle);
             A_1.set_Color((PdfRGBColor)this.method_1().WordBookmarksColor);
             A_1.set_DisplayStyle(this.method_24(this.method_1().WordBookmarksTextStyle));
         }
         for (int i = 0; i < A_0.Count; i++)
         {
             BookmarkLevel level = A_0[i];
             if ((this.pdfNewDocument_0.get_Pages().get_Count() >= level.TargetPageNumber) && (level.TargetPageNumber != 0))
             {
                 PdfPageBase base2 = this.pdfNewDocument_0.get_Pages().get_Item(level.TargetPageNumber - 1);
                 RectangleF  ef    = new RectangleF();
                 PdfDocumentLinkAnnotation annotation = new PdfDocumentLinkAnnotation(ef);
                 PdfBookmark bookmark = null;
                 annotation.set_Border(new PdfAnnotationBorder(0f));
                 PdfDestination destination = new PdfDestination(base2, level.TargetBounds.Location);
                 bookmark = A_1.Add(level.Name);
                 bookmark.set_Color((!(level.Color == Color.SaddleBrown) || !(this.method_1().WordBookmarksColor != Color.SaddleBrown)) ? ((PdfRGBColor)level.Color) : ((PdfRGBColor)this.method_1().WordBookmarksColor));
                 bookmark.set_DisplayStyle(((level.Style != BookmarkTextStyle.Bold) || (this.method_1().WordBookmarksTextStyle == BookmarkTextStyle.Bold)) ? this.method_24(level.Style) : this.method_24(this.method_1().WordBookmarksTextStyle));
                 annotation.set_Destination(destination);
                 bookmark.set_Action(new PdfGoToAction(annotation.get_Destination()));
                 if (base2 is PdfNewPage)
                 {
                     (base2 as PdfNewPage).get_Annotations().Add(annotation);
                 }
                 else
                 {
                     (base2 as PdfPageWidget).get_AnnotationsWidget().Add(annotation);
                 }
                 if ((level.ChildObjects.Count > 0) && (bookmark != null))
                 {
                     this.method_22(level.ChildObjects, bookmark);
                 }
             }
         }
     }
 }
Example #2
0
 private void method_20(List <Dictionary <string, Class310> > A_0, Dictionary <string, PdfBookmark> A_1, bool A_2)
 {
     for (int i = 0; i < A_0.Count; i++)
     {
         foreach (KeyValuePair <string, Class310> pair in A_0[i])
         {
             Class310 class2 = pair.Value;
             if (class2.method_16() == A_2)
             {
                 int index = this.pdfNewDocument_0.get_Pages().IndexOf(this.pdfPageBase_0);
                 if (class2.method_6() == (index + 1))
                 {
                     if (pair.Value.method_12() == 1)
                     {
                         A_1.Clear();
                     }
                     if (!pair.Key.Equals(string.Empty))
                     {
                         float height = this.method_0()[index].PageSize.Height;
                         PdfDocumentLinkAnnotation annotation = new PdfDocumentLinkAnnotation(class2.method_0());
                         annotation.set_Border(new PdfAnnotationBorder(0f));
                         if ((this.pdfNewDocument_0.get_Pages().get_Count() >= class2.method_4()) && (class2.method_4() != 0))
                         {
                             PdfDestination destination = new PdfDestination(this.pdfNewDocument_0.get_Pages().get_Item(class2.method_4() - 1), class2.method_2().Location);
                             string[]       strArray    = class2.method_8().Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                             if ((strArray.Length > 2) && (strArray[1] == strArray[2]))
                             {
                                 PdfBookmark bookmark = this.pdfNewDocument_0.get_Bookmarks().Add(class2.method_10());
                                 bookmark.set_Color((PdfRGBColor)Color.SaddleBrown);
                                 bookmark.set_DisplayStyle(2);
                                 annotation.set_Destination(destination);
                                 bookmark.set_Action(new PdfGoToAction(annotation.get_Destination()));
                             }
                             else if (pair.Value.method_12() == 0)
                             {
                                 annotation.set_Destination(destination);
                             }
                             else if (pair.Value.method_12() == 1)
                             {
                                 PdfBookmark bookmark3 = this.pdfNewDocument_0.get_Bookmarks().Add(class2.method_10());
                                 bookmark3.set_Color((PdfRGBColor)Color.SaddleBrown);
                                 bookmark3.set_DisplayStyle(2);
                                 annotation.set_Destination(destination);
                                 bookmark3.set_Action(new PdfGoToAction(annotation.get_Destination()));
                                 A_1.Add(pair.Value.method_12().ToString(), bookmark3);
                             }
                             else
                             {
                                 PdfBookmark bookmark4 = null;
                                 A_1.TryGetValue((pair.Value.method_12() - 1).ToString(), out bookmark4);
                                 if (bookmark4 != null)
                                 {
                                     PdfBookmark bookmark2 = bookmark4.Add(class2.method_10());
                                     bookmark2.set_Color((PdfRGBColor)Color.SaddleBrown);
                                     bookmark2.set_DisplayStyle(2);
                                     annotation.set_Destination(destination);
                                     bookmark2.set_Action(new PdfGoToAction(annotation.get_Destination()));
                                     if (A_1.ContainsKey(pair.Value.method_12().ToString()))
                                     {
                                         A_1.Remove(pair.Value.method_12().ToString());
                                     }
                                     A_1.Add(pair.Value.method_12().ToString(), bookmark2);
                                 }
                             }
                         }
                         if (this.pdfPageBase_0 is PdfNewPage)
                         {
                             (this.pdfPageBase_0 as PdfNewPage).get_Annotations().Add(annotation);
                         }
                         else
                         {
                             (this.pdfPageBase_0 as PdfPageWidget).get_AnnotationsWidget().Add(annotation);
                         }
                     }
                 }
             }
         }
     }
 }