Exemplo n.º 1
0
        /// <summary>
        /// 打印指定页面
        /// </summary>
        /// <param name="myPage">页面对象</param>
        /// <param name="g">绘图操作对象</param>
        /// <param name="MainClipRect">主剪切矩形</param>
        /// <param name="PrintHead">是否打印页眉</param>
        /// <param name="PrintTail">是否打印页脚</param>
        protected void PaintPage(
            PrintPage myPage,
            System.Drawing.Graphics g,
            System.Drawing.Rectangle MainClipRect,
            bool DrawHead,
            bool DrawFooter)
        {
            DocumentPageDrawer drawer = new DocumentPageDrawer(myDocument, this.myDocument.Pages);

            drawer.DrawFooter = DrawFooter;
            drawer.DrawHead   = DrawHead;
            drawer.DrawPage(myPage, g, MainClipRect, true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建文档指定页的位图
        /// </summary>
        /// <param name="doc">文档对象</param>
        /// <param name="pages">页面集合</param>
        /// <param name="PageIndex">指定页的序号</param>
        /// <param name="DrawBorder">是否绘制页面边框</param>
        /// <returns>生成的BMP位图文档对象</returns>
        public static System.Drawing.Bitmap GetPageBmp(
            IPageDocument doc,
            PrintPageCollection pages,
            int PageIndex,
            bool DrawBorder)
        {
            DocumentPageDrawer drawer = new DocumentPageDrawer();

            drawer.Document  = doc;
            drawer.Pages     = pages;
            drawer.BackColor = System.Drawing.Color.White;
            if (DrawBorder)
            {
                drawer.BorderColor = System.Drawing.Color.Black;
            }
            else
            {
                drawer.BorderColor = System.Drawing.Color.Transparent;
            }
            System.Drawing.Bitmap bmp = drawer.GetPageBmp(pages[PageIndex], true);
            return(bmp);
        }