コード例 #1
0
        /// <summary>
        /// Draw PDF using the template and this data.
        /// </summary>
        /// <param name="headerData"></param>
        /// <param name="loopData"></param>
        /// <param name="bodyData"></param>
        /// <param name="footerData"></param>
        /// <param name="tableHeadData"></param>
        /// <param name="tableLoopData"></param>
        /// <param name="tableFootData"></param>
        public void Draw(
            Hashtable headerData,
            List <Hashtable> loopData,
            Hashtable bodyData,
            Hashtable footerData,
            Hashtable tableHeadData,
            List <Hashtable> tableLoopData,
            Hashtable tableFootData)
        {
            if (headerData != null)
            {
                this.headerData = headerData;
            }
            if (bodyData != null)
            {
                this.bodyData = bodyData;
            }
            if (footerData != null)
            {
                this.footerData = footerData;
            }

            var tableData = new TableData
            {
                HeadData = tableHeadData,
                LoopData = tableLoopData,
                FootData = tableFootData
            };

            if (DrawCallCounter > 0)
            {
                // how many times the Draw() hv been call! if it was call b4, this time we draw to a new page!
                NextPage();
            }

            DrawHeader();

            if (principalTableGenerator != null && tableData.LoopData != null)
            {
                principalTableGenerator.DrawTable(tableData, PdfDrawer);
            }

            if (loopData != null)
            {
                _drawLoop(loopData);
            }

            if (bodyGenerator != null)
            {
                bodyGenerator.DrawBody(bodyData, PdfDrawer);
            }

            _drawFooter();

            EachPageCount.Add(PageCount);
            DrawCallCounter++;
        }