Exemplo n.º 1
0
 public override IEnumerable <string> GetGroupNames()
 {
     lock (this)
     {
         return(IteratorUtils.ToList(base.GetGroupNames().GetEnumerator()));
     }
 }
Exemplo n.º 2
0
        public void testComparator()
        {
            List <String> data = new List <String>(3);

            data.Add("baz");
            data.Add("bar");
            data.Add("foo");
            Assert.AreEqual(TEST_DATA, IteratorUtils.iterableToList(data, String.CASE_INSENSITIVE_ORDER));
        }
Exemplo n.º 3
0
        public void testCollection()
        {
            List <String> data = new TreeSet <String>();

            data.Add("foo");
            data.Add("bar");
            data.Add("baz");
            Assert.AreEqual(TEST_DATA, IteratorUtils.iterableToList(data));
        }
Exemplo n.º 4
0
        public void SplitByPageRanges(string pageRanges)
        {
            int num;
            int num1;
            int num2;
            int num3;

            if (this.CheckOutput())
            {
                PDFHelper.DisplayTrialPopupIfNecessary();
                try
                {
                    string[] strArrays  = pageRanges.Split(new char[] { ',' });
                    List     list       = IteratorUtils.toList(this.pdfDocument.PDFBoxDocument.getPages().iterator());
                    int      num4       = list.size();
                    string[] strArrays1 = strArrays;
                    for (int i = 0; i < (int)strArrays1.Length; i++)
                    {
                        string str = strArrays1[i];
                        if (this.ConfigureRange(str, num4, out num, out num1, out num2, out num3))
                        {
                            List       list1      = list.subList(num, num1);
                            PDDocument pDDocument = new PDDocument();
                            for (int j = num2; j < list1.size(); j = j + num3)
                            {
                                PDPage pDPage = (PDPage)list1.@get(j);
                                pDPage.getResources();
                                pDDocument.addPage(pDPage);
                            }
                            pDDocument = PDFHelper.AddTrialStampIfNecessary(pDDocument);
                            string str1 = string.Format("{0} [{1}].pdf", this.OutputFileName, str);
                            pDDocument.save(Path.Combine(this.OutputFilePath, str1));
                        }
                        else
                        {
                            Console.WriteLine("Invalid range: {0}", str);
                        }
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    throw new PDFToolkitException(exception.Message, exception.InnerException);
                }
            }
        }
Exemplo n.º 5
0
        private void SplitByRepeatingPageRanges(string pageRange, int repeatEvery, PDPageTree allPages, int pageCount, string suffix)
        {
            int num;
            int num1;
            int num2;
            int num3;

            if (this.ConfigureRange(pageRange, pageCount, out num, out num1, out num2, out num3))
            {
                List       list       = IteratorUtils.toList(allPages.iterator());
                List       list1      = list.subList(num, num1);
                PDDocument pDDocument = new PDDocument();
                for (int i = num2; i < list1.size(); i = i + num3)
                {
                    pDDocument.addPage((PDPage)list1.@get(i));
                }
                pDDocument = PDFHelper.AddTrialStampIfNecessary(pDDocument);
                string str = string.Format("{0} [{1}].pdf", this.OutputFileName, this.splitCounter);
                pDDocument.save(Path.Combine(this.OutputFilePath, str));
                if (repeatEvery > 0)
                {
                    num  = num + repeatEvery + 1;
                    num1 = num1 + repeatEvery;
                    if (num <= pageCount)
                    {
                        if (num1 > pageCount)
                        {
                            num1 = pageCount;
                        }
                        this.splitCounter = this.splitCounter + 1;
                        string str1 = string.Format("{0}-{1}{2}", num, num1, suffix);
                        this.SplitByRepeatingPageRanges(str1, repeatEvery, allPages, pageCount, suffix);
                    }
                }
            }
            else
            {
                Console.WriteLine("Invalid page range.");
            }
        }
Exemplo n.º 6
0
        public List <PDFAnnotation> GetAnnotations()
        {
            List <PDFAnnotation> pDFAnnotations;

            try
            {
                List <PDFAnnotation> pDFAnnotations1 = new List <PDFAnnotation>();
                object[]             objArray        = IteratorUtils.toArray(this.PDFBoxPage.getAnnotations().iterator());
                object[]             objArray1       = objArray;
                for (int i = 0; i < (int)objArray1.Length; i++)
                {
                    pDFAnnotations1.Add(new PDFAnnotation((PDAnnotation)objArray1[i]));
                }
                pDFAnnotations = pDFAnnotations1;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw new PDFToolkitException(exception.Message, exception);
            }
            return(pDFAnnotations);
        }
Exemplo n.º 7
0
        public PDFBookmark GetBookmarks()
        {
            PDFBookmark pDFBookmark;

            try
            {
                PDDocumentOutline documentOutline = this.PDFBoxDocument.getDocumentCatalog().getDocumentOutline();
                PDFBookmark       pDFBookmark1    = new PDFBookmark();
                object[]          objArray        = IteratorUtils.toArray(documentOutline.children().iterator());
                for (int i = 0; i < (int)objArray.Length; i++)
                {
                    object obj = objArray[i];
                    PDFHelper.addBookmark((PDOutlineItem)obj, pDFBookmark1.BookmarkItems, this.PDFBoxDocument);
                }
                pDFBookmark = pDFBookmark1;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw new PDFToolkitException(exception.Message, exception);
            }
            return(pDFBookmark);
        }
Exemplo n.º 8
0
 public void TestEmpty()
 {
     Assert.AreEqual(0, IteratorUtils.IterableToList(new List <Object>(0)).Count);
 }
Exemplo n.º 9
0
 public void testList()
 {
     Assert.AreEqual(TEST_DATA, IteratorUtils.iterableToList(TEST_DATA));
 }
Exemplo n.º 10
0
 public void testArray()
 {
     String[] data = TEST_DATA.toArray(new String[3]);
     Assert.AreEqual(TEST_DATA, IteratorUtils.iterableToList(new ArrayIterator <String>(data)));
 }