一个C#通过iTextSharp封装的PDF文件操作类源码

这是一个C#编程中的PDFOperation类,利用iTextSharp库进行PDF文件操作。该类初始化时设定页面大小为A4,并创建Document对象。
摘要由CSDN通过智能技术生成

如下内容内容是关于一个C#通过iTextSharp封装的PDF文件操作类的内容,希望对各位有用处。

using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;

namespace DotNet.Utilities
{
public class PDFOperation
{
#region 构造函数
public PDFOperation()
{
rect = PageSize.A4;
document = new Document(rect);
}

    public PDFOperation(string type)
    {
        SetPageSize(type);
        document = new Document(rect);
    }

    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;
    #endregion

    #region 设置字体
    public void SetBaseFont(string path)
    {
        basefont = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
   
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值