asp.net工具类-PDFOperation
2017-10-05 23:56:55   来源:   评论:0 点击:

using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;    /// <summary>
/// PDF文档操作类
/// </summary>
//------------------------------------调用--------------------------------------------
//PDFOperation pdf = new PDFOperation();
//pdf.Open(new FileStream(path, FileMode.Create));
//pdf.SetBaseFont(@"C:\Windows\Fonts\SIMHEI.TTF");
//pdf.AddParagraph("测试文档(生成时间:" + DateTime.Now + ")", 15, 1, 20, 0, 0);
//pdf.Close();
//--------------------------------------------------------------------------------
public class PDFOperation
{
    #region 构造函数
    /// <summary>
        /// 构造函数
        /// </summary>
        public PDFOperation()
        {
                rect = PageSize.A4;
                document = new Document(rect);
        }
            /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">页面大小(如"A4")</param>
        public PDFOperation(string type)
        {
                SetPageSize(type);
                document = new Document(rect);
        }
            /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">页面大小(如"A4")</param>
        /// <param name="marginLeft">内容距左边框距离</param>
        /// <param name="marginRight">内容距右边框距离</param>
        /// <param name="marginTop">内容距上边框距离</param>
        /// <param name="marginBottom">内容距下边框距离</param>
        public PDFOperation(string type,float marginLeft, float marginRight, float marginTop, float marginBottom)
        {
                SetPageSize(type);
                document = new Document(rect,marginLeft,marginRight,marginTop,marginBottom);
    }
    #endregion

相关热词搜索:工具

上一篇:在ASP.NET中随意创建图形信息
下一篇:最后一页

分享到: 收藏
评论排行