示例#1
0
        //
        // ctor
        //

        public PDFPageNumberGroup(PDFPageNumbers owner, string groupName, PageNumberStyle style, int startindex)
        {
            this.Owner          = owner;
            this.GroupName      = groupName;
            this.GroupPageCount = 0;
            this._options       = new NumberGroupOptions()
            {
                Style = style, StartNumber = startindex
            };
            this._currSequence = null;
        }
示例#2
0
        /// <summary>
        /// Starts the counting of pages (from the specified page index)
        /// </summary>
        /// <param name="pgIndex"></param>
        public void BeginCounting(int pgIndex)
        {
            if (null != _currSequence)
            {
                throw new InvalidOperationException("This group is already counting - use the IsCounting property to check first");
            }

            _currSequence = new NumberGroupSequence()
            {
                StartPageIndex = pgIndex, EndPageIndex = pgIndex, PreviousCount = this.GroupPageCount
            };
        }
示例#3
0
        /// <summary>
        /// Completes a sequence of pages and adds the registation of page numbers to this
        /// </summary>
        public void EndCounting()
        {
            if (!this.IsCounting)
            {
                throw new InvalidOperationException("This group is not currently counting - use the isCounting property to check");
            }

            NumberGroupSequence seq = this._currSequence;

            PDFPageNumberRegistration reg = new PDFPageNumberRegistration(seq.StartPageIndex, seq.EndPageIndex, this);

            //If we have an existing count to this group then we need to add the numbering offset to the sequence
            reg.PreviousLinkedRegistrationPageCount = this.GroupPageCount;

            this.Owner.Registrations.Add(reg);
            this.GroupPageCount += this._currSequence.SequencePageCount;
            this._currSequence   = null;
        }