C#代码实现PDF文档操作类

2019-12-26 14:14:47王振洲
  •   /// <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    #region 私有字段 
  •   private Font font;    private Rectangle rect; //文档大小 
  •   private Document document;//文档对象    private BaseFont basefont;//字体 
  •   #endregion    #region 设置字体 
  •   /// <summary>    /// 设置字体 
  •   /// </summary>    public void SetBaseFont(string path) 
  •   {     basefont = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); 
  •   }    /// <summary> 
  •   /// 设置字体    /// </summary> 
  •   /// <param name="size">字体大小</param>    public void SetFont(float size) 
  •   {     font = new Font(basefont, size); 
  •   }    #endregion 
  •   #region 设置页面大小    /// <summary> 
  •   /// 设置页面大小    /// </summary> 
  •   /// <param name="type">页面大小(如"A4")</param>    public void SetPageSize(string type)