public void ValueTest(int value, PageNumberingStyle style, string result)
        {
            var module = Module;

            module.Style   = style;
            module.Current = value;
            var x = module.Next();

            Assert.Equal(result, x);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.PageLabel.
        /// </summary>
        /// <param name="firstPageIndex" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx"> The page index of the first page in a labeling range.</param>
        /// <param name="style">The style of the page label.</param>
        public PageLabel(int firstPageIndex, PageNumberingStyle style)
        {
            if (firstPageIndex < 0)
            {
                throw new IndexOutOfRangeException();
            }

            _firstPageIndex = firstPageIndex;
            _dictionary     = new PDFDictionary();
            _dictionary.AddItem("S", TypeConverter.PDFPageNumberingStyleToPDFName(style));
        }
Esempio n. 3
0
        public static PageLabelRange Create(string prefix, int start, PageNumberingStyle style, bool indirect)
        {
            PageLabelRange range1 = (Resources.Get(Library.CreateDict(), typeof(PageLabelRange)) as PageLabelRange);

            range1.Prefix         = prefix;
            range1.Start          = start;
            range1.NumberingStyle = style;
            if (indirect)
            {
                Library.CreateIndirect(range1.Direct);
            }
            return(range1);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.PageLabel.
        /// </summary>
        /// <param name="firstPageIndex" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx"> The page index of the first page in a labeling range.</param>
        /// <param name="style">The style of the page label.</param>
        /// <param name="prefix" href="http://msdn.microsoft.com/en-us/library/system.string.aspx">The prefix of the page label.</param>
        public PageLabel(int firstPageIndex, PageNumberingStyle style, string prefix)
        {
            if (firstPageIndex < 0)
            {
                throw new IndexOutOfRangeException();
            }
            if (prefix == null)
            {
                prefix = string.Empty;
            }

            _firstPageIndex = firstPageIndex;
            _dictionary     = new PDFDictionary();
            _dictionary.AddItem("S", TypeConverter.PDFPageNumberingStyleToPDFName(style));
            _dictionary.AddItem("P", new PDFString(prefix));
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the Bytescout.PDF.PageLabel.
        /// </summary>
        /// <param name="firstPageIndex" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx"> The page index of the first page in a labeling range.</param>
        /// <param name="style">The style of the page label.</param>
        /// <param name="startPortion" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx">The start portion of the page label.</param>
        public PageLabel(int firstPageIndex, PageNumberingStyle style, int startPortion)
        {
            if (firstPageIndex < 0)
            {
                throw new IndexOutOfRangeException();
            }
            if (startPortion < 1)
            {
                throw new ArgumentOutOfRangeException("startPortion");
            }

            _firstPageIndex = firstPageIndex;
            _dictionary     = new PDFDictionary();
            _dictionary.AddItem("S", TypeConverter.PDFPageNumberingStyleToPDFName(style));
            _dictionary.AddItem("St", new PDFNumber(startPortion));
        }
Esempio n. 6
0
        public static PDFName PDFPageNumberingStyleToPDFName(PageNumberingStyle style)
        {
            switch (style)
            {
            case PageNumberingStyle.DecimalArabic:
                return(new PDFName("D"));

            case PageNumberingStyle.UppercaseRoman:
                return(new PDFName("R"));

            case PageNumberingStyle.LowercaseRoman:
                return(new PDFName("r"));

            case PageNumberingStyle.UppercaseLetters:
                return(new PDFName("A"));

            case PageNumberingStyle.LowercaseLetters:
                return(new PDFName("a"));
            }
            return(new PDFName(""));
        }
Esempio n. 7
0
 /// <summary> </summary>
 public PageLabel CreatePageLabel(int firstPageIndex, PageNumberingStyle style)
 {
     return(new PageLabel(firstPageIndex, style));
 }
 public void Add(int firstPage, PageNumberingStyle style, string prefix, int start)
 {
     this[firstPage] = PageLabelRange.Create(prefix, start, style, true);
 }