コード例 #1
0
    private PdfNewDocument method_26(Class195 A_0)
    {
        this.method_15(A_0);
        int count = A_0.method_0().Count;
        int num3  = (count > 90) ? 3 : ((count > 60) ? 5 : ((count > 30) ? 10 : count));

        this.pdfNewDocument_0 = this.method_12();
        for (int i = 0; i < count; i++)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                A_0.method_57(i, 1, ImageType.Metafile, stream, false, false, true);
                PdfNewPage page = this.method_13(this.method_0()[i]).get_Pages().Add();
                this.pdfPageBase_0 = page;
                using (PdfMetafile metafile = PdfImage.FromImage(A_0.method_34().method_0()[i].method_0()))
                {
                    metafile.set_Quality((long)this.int_0);
                    metafile.ᜀ(page, new RectangleF(PointF.Empty, page.get_Size()), true, this.method_1().EmbeddedFontNameList, this.method_1().IsEmbeddedAllFonts, this.method_2());
                }
                this.method_18(A_0.method_34().method_0()[i].method_2());
                A_0.method_34().method_0()[i].method_0().Dispose();
                A_0.method_34().method_0()[i].method_1(null);
            }
            if ((i % num3) == 0)
            {
                GC.Collect();
            }
        }
        this.method_27(A_0, count, false);
        if (!this.method_1().CreateWordBookmarks)
        {
            this.method_27(A_0, count, true);
        }
        else if (A_0.method_11().Count > 0)
        {
            PdfBookmark bookmark = this.pdfNewDocument_0.get_Bookmarks().Add(this.method_1().WordBookmarksTitle);
            bookmark.set_Color((PdfRGBColor)this.method_1().WordBookmarksColor);
            bookmark.set_DisplayStyle(this.method_24(this.method_1().WordBookmarksTextStyle));
            this.method_22(A_0.method_11(), bookmark);
        }
        this.method_16(A_0.method_35().BuiltinDocumentProperties);
        A_0.method_51();
        return(this.pdfNewDocument_0);
    }
コード例 #2
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);
                 }
             }
         }
     }
 }
コード例 #3
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);
                         }
                     }
                 }
             }
         }
     }
 }