iTextSharpH
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO; public class iTextSharpH
{
/// <summary> 合并PDF </summary>
/// <param name="fileList">PDF文件集合</param>
/// <param name="outMergeFile">合并文件名</param>
public static void MergePDFFiles(string[] fileList, string outMergeFile)
{
List<PdfReader> readerList = new List<PdfReader>();//记录合并PDF集合
Document document = new Document();
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(outMergeFile, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage newPage;
for (int i = ; i < fileList.Length; i++)
{
if (!string.IsNullOrEmpty(fileList[i]))
{
PdfReader reader = new PdfReader(fileList[i]);
int iPageNum = reader.NumberOfPages;
for (int j = ; j <= iPageNum; j++)
{
document.NewPage();
newPage = writer.GetImportedPage(reader, j);
cb.AddTemplate(newPage, , );
}
readerList.Add(reader);
}
}
document.Close();
//释放集合资源
foreach (var rd in readerList)
{
rd.Close();
}
}
}
iTextSharpH的更多相关文章
随机推荐
- Git回滚代码到某个commit
回退命令: $ git reset --hard HEAD^ 回退到上个版本$ git reset --hard HEAD~3 回退到前3次提交之前,以此类推,回退到n次提交之前 $ git rese ...
- adb shell am broadcast 手动发送广播及adb shell am/pm其他命令
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zi_zhe/article/details/72229201 在命令行可用adb shell am ...
- Android触摸事件(一)-TouchEventHelper
文件夹 文件夹 概述 关于更新 2016-08-31 2016-06-20 关于单点触摸事件singleTouch 单击的两种方式 关于双击事件 双击事件的检測逻辑 双击事件触发的时机 关于多点触摸事 ...
- FILESTREAM feature can't be enabled if you use cluster shared volumes
Create a SQL Cluster instance. Create Cluster Shared Volume Please note. No Share storage is added i ...
- SQL Server does not purge row versioning records even the transaction are committed if there are other open transaction running in the databases with read-committed snapshot enabled .
This is a by-design behavior. There is only one allocation unit in tempdb that istracking the versio ...
- 不同语言的水仙花性能比较【Test1W】
看了大佬@鱼丸粗面一碗的文章:<这段代码,c 1秒,java 9秒,c# 14秒,而python...>,基于水仙花数的各种语言1W次性能比较,觉得很有意思.于是开启cv大法,把我有环境的 ...
- laravel5.8笔记七:语言包
语言包控制config/app.php 'locale' => 'en', 语言包位置:resources/lang/cn/ 建立resources/lang/cn/common.php < ...
- JS的eval函数解密反混淆
https://www.hhtjim.com/js-decryption-de-obfuscate-eval-function.html JS的eval函数解密反混淆
- 三、Sql Server 基础培训《进度3-是否使用外键(知识点学习)》
学习作业3: 问题1:你觉得外键有哪些适用情况?哪些不适用情况? 问题2:本次实战案例,由你来架构,你觉得有必要建立外键吗? 说明你的理由? ======================= ...
- chrome 浏览器之下载管理器插件
chrome默认下载器实在是不招人待见,下面插件是一个非常不错的选择: 名称:Chrono下载管理器 插件地址:https://chrome.google.com/webstore/detail/ch ...