private void SetFooter(PdfDocument document)
        {
            if (m_formCollection["checkBoxAddFooter"].Count > 0)
            {
                return;
            }

            //create the document footer
            document.CreateFooterCanvas(50);

            // layout HTML in footer
            PdfHtml footerHtml = new PdfHtml(5, 5, @"<span style=""color:Navy; font-family:Times New Roman; font-style:italic"">
                            Quickly Create High Quality PDFs with </span><a href=""http://www.hiqpdf.com"">HiQPdf</a>", null);

            footerHtml.FitDestHeight = true;
            footerHtml.FontEmbedding = true;
            document.Footer.Layout(footerHtml);


            float footerHeight = document.Footer.Height;
            float footerWidth  = document.Footer.Width;

            // add page numbering
            System.Drawing.Font pageNumberingFont = new System.Drawing.Font(new System.Drawing.FontFamily("Times New Roman"), 8, System.Drawing.GraphicsUnit.Point);
            PdfText             pageNumberingText = new PdfText(5, footerHeight - 12, "Page {CrtPage} of {PageCount}", pageNumberingFont);

            pageNumberingText.HorizontalAlign = PdfTextHAlign.Center;
            pageNumberingText.EmbedSystemFont = true;
            pageNumberingText.ForeColor       = System.Drawing.Color.DarkGreen;
            document.Footer.Layout(pageNumberingText);

            string   footerImageFile = m_hostingEnvironment.ContentRootPath + @"\wwwroot" + @"\DemoFiles\Images\HiQPdfLogo.png";
            PdfImage logoFooterImage = new PdfImage(footerWidth - 40 - 5, 5, 40, System.Drawing.Image.FromFile(footerImageFile));

            document.Footer.Layout(logoFooterImage);

            // create a border for footer
            PdfRectangle borderRectangle = new PdfRectangle(1, 1, footerWidth - 2, footerHeight - 2);

            borderRectangle.LineStyle.LineWidth = 0.5f;
            borderRectangle.ForeColor           = System.Drawing.Color.DarkGreen;
            document.Footer.Layout(borderRectangle);
        }
        private void SetFooter(PdfDocument document, string fileName = "")
        {
            //create the document footer
            document.CreateFooterCanvas(45);

            string   logoImageFile = HttpContext.Current.Server.MapPath(Utility.GetAPPSettingKey("ImageFolder") + "PDFCover/DRx_logo_2013.png");
            PdfImage logoImage     = new PdfImage(5, 5, 40, Image.FromFile(logoImageFile));

            document.Footer.Layout(logoImage);

            Font pageFooterFont =
                new Font(new System.Drawing.FontFamily("Verdana"),
                         5, System.Drawing.GraphicsUnit.Point);

            document.Footer.Layout(new PdfHtml(0, 10, "<a href=\"http://www.discoverx.com\" style=\"font-family:Verdana; font-size:9px; color:black; text-decoration:none\">http://www.discoverx.com</a>", null));

            string footerStr = string.Empty;

            if (fileName == "DRx_Price_List_")
            {
                footerStr = PRICE_LIST_FOOTER;
            }
            else if (fileName == "DRx_Target_List_")
            {
                footerStr = TARGET_LIST_FOOTER;
            }


            // layout HTML in footer
            //footerHtml.FitDestHeight = true;
            PdfText centerText = new PdfText(10, 10,
                                             footerStr, pageFooterFont);

            centerText.HorizontalAlign = PdfTextHAlign.Center;
            centerText.EmbedSystemFont = true;
            centerText.ForeColor       = System.Drawing.Color.Black;
            document.Footer.Layout(centerText);
            //htmlToPdfDocument.Footer.Layout(new PdfHtml(200, 5, footerStr, null));

            PdfText rightText = new PdfText(10, 15,
                                            string.Format("Q{0} - {1}", DateTime.Now.GetQuarter(), DateTime.Now.Year), pageFooterFont);

            rightText.HorizontalAlign = PdfTextHAlign.Right;
            rightText.EmbedSystemFont = true;
            rightText.ForeColor       = System.Drawing.Color.Black;
            document.Footer.Layout(rightText);
            // layout HTML in footer
            PdfHtml footerHtml = new PdfHtml(5, 5, footerStr, null);

            footerHtml.FitDestHeight = true;
            footerHtml.FontEmbedding = true;
            document.Footer.Layout(footerHtml);


            float footerHeight = document.Footer.Height;
            float footerWidth  = document.Footer.Width;

            // add page numbering
            Font pageNumberFont = new Font(new FontFamily("Verdana"), 6, GraphicsUnit.Point);
            //pageNumberingFont.Mea

            PdfText pageNumberingText = new PdfText(5, footerHeight - 25, "Page {CrtPage}", pageNumberFont);

            pageNumberingText.HorizontalAlign = PdfTextHAlign.Center;
            pageNumberingText.EmbedSystemFont = true;
            pageNumberingText.ForeColor       = Color.Black;
            document.Footer.Layout(pageNumberingText);

            //string footerImageFile = Application.StartupPath + @"\DemoFiles\Images\HiQPdfLogo.png";
            //PdfImage logoFooterImage = new PdfImage(footerWidth - 40 - 5, 5, 40, Image.FromFile(footerImageFile));
            //document.Footer.Layout(logoFooterImage);

            //// create a border for footer
            //PdfRectangle borderRectangle = new PdfRectangle(1, 1, footerWidth - 2, footerHeight - 2);
            //borderRectangle.LineStyle.LineWidth = 0.5f;
            //borderRectangle.ForeColor = Color.DarkGreen;
            //document.Footer.Layout(borderRectangle);
        }