Ejemplo n.º 1
0
        /// <summary>
        /// Allow to append a new content stream after the current one and select it
        /// </summary>
        public void NewContentStreamAfter()
        {
            var index = Math.Min(contentStreams.IndexOf(currentStream) + 1, contentStreams.Count);

            currentStream = new DefaultContentStream();
            contentStreams.Insert(index, currentStream);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allow to append a new content stream before the current one and select it
        /// </summary>
        public void NewContentStreamBefore()
        {
            var index = Math.Max(contentStreams.IndexOf(currentStream) - 1, 0);

            currentStream = new DefaultContentStream();
            contentStreams.Insert(index, currentStream);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Select a content stream from the list, by his index
        /// </summary>
        /// <param name="index">index of the content stream to be selected</param>
        public void SelectContentStream(int index)
        {
            if (index < 0 || index >= contentStreams.Count)
            {
                throw new IndexOutOfRangeException(nameof(index));
            }

            currentStream = contentStreams[index];
        }
Ejemplo n.º 4
0
 internal PdfPageBuilder(int number, PdfDocumentBuilder documentBuilder, IEnumerable <CopiedContentStream> copied,
                         Dictionary <NameToken, IToken> pageDict)
 {
     this.documentBuilder = documentBuilder ?? throw new ArgumentNullException(nameof(documentBuilder));
     PageNumber           = number;
     pageDictionary       = pageDict;
     contentStreams       = new List <IPageContentStream>();
     contentStreams.AddRange(copied);
     currentStream = new DefaultContentStream();
     contentStreams.Add(currentStream);
 }
Ejemplo n.º 5
0
        internal PdfPageBuilder(int number, PdfDocumentBuilder documentBuilder)
        {
            this.documentBuilder = documentBuilder ?? throw new ArgumentNullException(nameof(documentBuilder));
            PageNumber           = number;

            currentStream  = new DefaultContentStream();
            contentStreams = new List <IPageContentStream>()
            {
                currentStream
            };
        }