Example #1
0
        public void PageRomanUpperWithStartIndexAndPrefixCollection()
        {
            int startindex  = 4;
            int repeatcount = 20;

            //index                0     1    2      3      4      5     6    7      8      9      10     11    12     13       14      15    16     17      18      19
            string[] expected = { "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX", "XXI", "XXII", "XXIII" };

            PDFPageNumbers col   = new PDFPageNumbers();
            Style          style = new Style();

            style.PageStyle.NumberStyle      = PageNumberStyle.UppercaseRoman;
            style.PageStyle.NumberStartIndex = startindex;
            col.StartNumbering(style.CreatePageNumberOptions());

            col.Register(0);
            col.UnRegister(19);
            col.EndNumbering();

            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);

                Assert.AreEqual(expected[i], actual);
            }
        }
Example #2
0
        public void PageRomanLowerCollection()
        {
            int repeatcount = 20;

            //index                0    1     2       3    4    5      6      7      8     9    10    11      12     13     14    15      16      17      18     19
            string[] expected = { "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", "xi", "xii", "xiii", "xiv", "xv", "xvi", "xvii", "xviii", "xix", "xx" };

            PDFPageNumbers col = new PDFPageNumbers();

            col.StartNumbering(null);

            Style full = new Style();

            full.PageStyle.NumberStyle = PageNumberStyle.LowercaseRoman;
            PDFPageNumberOptions opts = full.CreatePageNumberOptions();

            col.PushPageNumber(opts);

            col.Register(0);
            col.UnRegister(19);
            col.EndNumbering();

            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);

                Assert.AreEqual(expected[i], actual);
            }
        }
Example #3
0
        public void PageEmptyCollection()
        {
            int repeatcount = 20;

            //index                0    1    2    3    4    5    6    7    8    9     10    11    12    13    14    15    16    17    18    19
            string[] expected = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };

            PDFPageNumbers col = new PDFPageNumbers();

            col.StartNumbering(null);

            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);

                Assert.AreEqual(expected[i], actual);
            }
        }
Example #4
0
        public void PageNoneCollection()
        {
            int repeatcount = 20;

            PDFPageNumbers col   = new PDFPageNumbers();
            Style          style = new Style();

            style.PageStyle.NumberStyle = PageNumberStyle.None;
            col.StartNumbering(style.CreatePageNumberOptions());

            col.Register(0);
            col.UnRegister(19);
            col.EndNumbering();

            for (int i = 0; i < repeatcount; i++)
            {
                string actual   = col.GetPageLabel(i);
                string expected = string.Empty;
                Assert.AreEqual(expected, actual);
            }
        }
Example #5
0
        public void PageDecimalsCollection()
        {
            int repeatcount = 20;

            //index                0    1    2    3    4    5    6    7    8    9     10    11    12    13    14    15    16    17    18    19
            string[] expected = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };

            PDFPageNumbers col = new PDFPageNumbers();

            PDFPageNumberOptions options = new PDFPageNumberOptions()
            {
                NumberStyle = PageNumberStyle.Decimals
            };

            col.StartNumbering(options);

            col.Register(0);
            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);
                Assert.AreEqual(expected[i], actual);
            }
        }
Example #6
0
        public void PageLetterUpperCollection()
        {
            int repeatcount = 29;

            //index                0    1    2    3    4    5    6    7    8    9   10    11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26    27    28
            string[] expected = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "BB", "CC" };

            PDFPageNumbers col = new PDFPageNumbers();

            Style full = new Style();

            full.PageStyle.NumberStyle = PageNumberStyle.UppercaseLetters;
            col.StartNumbering(full.CreatePageNumberOptions());

            col.Register(0);
            col.UnRegister(28);
            col.EndNumbering();
            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);

                Assert.AreEqual(expected[i], actual);
            }
        }
Example #7
0
        public void PageLetterLowerCollection()
        {
            int repeatcount = 29;

            //index                0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25    26    27    28
            string[] expected = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "aa", "bb", "cc" };

            PDFPageNumbers col = new PDFPageNumbers();

            Style full = new Style();

            full.PageStyle.NumberStyle = PageNumberStyle.LowercaseLetters;
            col.StartNumbering(full.CreatePageNumberOptions());

            col.Register(0);
            col.UnRegister(28);
            col.EndNumbering();

            for (int i = 0; i < repeatcount; i++)
            {
                string actual = col.GetPageLabel(i);
                Assert.AreEqual(expected[i], actual);
            }
        }
Example #8
0
        public void PageCollection_DefaultAndBack()
        {
            // page indices                          0,    1,   2,   3,   4,   5,   6,     7,    8,    9,  10,  11 , 12,  13,  14,  15,  16,  17,  18,   19
            string[] expectedlabels = new string[] { "1", "2", "3", "4", "5", "i", "ii", "iii", "iv", "v", "B", "C", "D", "E", "F", "6", "7", "8", "9", "10" };

            PDFPageNumbers col = new PDFPageNumbers();
            Style          def = new Style();

            def.PageStyle.NumberStyle      = PageNumberStyle.Decimals;
            def.PageStyle.NumberStartIndex = 1;
            col.StartNumbering(def.CreatePageNumberOptions());

            Style lowRoman = new Style();

            lowRoman.PageStyle.NumberStyle      = PageNumberStyle.LowercaseRoman;
            lowRoman.PageStyle.NumberStartIndex = 1;


            Style alpha = new Style();

            alpha.PageStyle.NumberStyle      = PageNumberStyle.UppercaseLetters;
            alpha.PageStyle.NumberStartIndex = 2;

            col.Register(0);
            col.Register(1);
            col.Register(2);
            col.Register(3);
            col.Register(4);

            PDFPageNumberGroup grp = col.PushPageNumber(lowRoman.CreatePageNumberOptions());

            col.Register(5);
            col.Register(6);
            col.Register(7);
            col.Register(8);
            col.Register(9);
            col.UnRegister(9);
            col.PopNumberStyle(grp);

            grp = col.PushPageNumber(alpha.CreatePageNumberOptions());
            col.Register(10);
            col.Register(11);
            col.Register(12);
            col.Register(13);
            col.Register(14);
            col.UnRegister(14);
            col.PopNumberStyle(grp);

            col.Register(15);
            col.Register(16);
            col.Register(17);
            col.Register(18);
            col.Register(19);
            col.UnRegister(19);
            col.EndNumbering();

            for (int i = 0; i < 20; i++)
            {
                string lbl = col.GetPageLabel(i);
                Assert.AreEqual(expectedlabels[i], lbl);
            }
        }