BaseSection.cs 827 Bytes
Newer Older
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
29
30
31
32
33
34
using iText.Kernel.Geom;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;

namespace PDFGenerator.DocumentStructures
{
    public abstract class BaseSection
    {
        protected Document Document { get; set; }

        public BaseSection(Document document)
        {
            Document = document;
        }

        /// <summary>
        /// Adds page break to document.
        /// </summary>
        public void AddPageBreak()
        {
            Document.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
        }

        /// <summary>
        /// Gets default page size. 
        /// </summary>
        /// <returns>The default page size.</returns>
        protected PageSize GetPageSize()
        {
            return Document.GetPdfDocument().GetDefaultPageSize();
        }
    }
}