如何将两个pdf文档通过.net编程合成一个,是通过控件吗 ?蛇么控件

lxd1979 2003-07-31 11:17:26
如题
...全文
449 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
ecstar 2003-09-10
  • 打赏
  • 举报
回复
To:Marguess(留侯)
不是吧?一定要控件吗?你出钱,我给你写,怎么样?
MarcuseXiao 2003-09-08
  • 打赏
  • 举报
回复
你的方法可行,不是用控件,要自己写代码
ecstar 2003-09-05
  • 打赏
  • 举报
回复
using System;
using System.IO;

using iTextSharp.text;
using iTextSharp.text.pdf;

public class Concat {

/**
* @param args the command line arguments
*/
public static void Main(String[] args) {
if (args.Length < 3) {
Console.Error.WriteLine("This tools needs at least 3 parameters:\njava Concat destfile file1 file2 [file3 ...]");
}
else {
try {
int f = 1;
// we create a reader for a certain document
PdfReader reader = new PdfReader(args[f]);
// we retrieve the total number of pages
int n = reader.NumberOfPages;
Console.WriteLine("There are " + n + " pages in the original file.");

// step 1: creation of a document-object
Document document = new Document(reader.getPageSizeWithRotation(1));
// step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.getInstance(document, new FileStream(args[0], FileMode.Create));
// step 3: we open the document
document.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;
int rotation;
// step 4: we add content
while (f < args.Length) {
int i = 0;
while (i < n) {
i++;
document.setPageSize(reader.getPageSizeWithRotation(i));
document.newPage();
page = writer.getImportedPage(reader, i);
rotation = reader.getPageRotation(i);
if (rotation == 90 || rotation == 270) {
cb.addTemplate(page, 0, -1f, 1f, 0, 0, reader.getPageSizeWithRotation(i).Height);
}
else {
cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
Console.WriteLine("Processed page " + i);
}
f++;
if (f < args.Length) {
reader = new PdfReader(args[f]);
// we retrieve the total number of pages
n = reader.NumberOfPages;
Console.WriteLine("There are " + n + " pages in the original file.");
}
}
// step 5: we close the document
document.Close();
}
catch(Exception e) {
Console.Error.WriteLine(e.Message);
Console.Error.WriteLine(e.StackTrace);
}
}
}

}

citylamp 2003-08-15
  • 打赏
  • 举报
回复
都没听说过呢。
活靶子哥哥 2003-08-14
  • 打赏
  • 举报
回复
GUANZHU
popcorn 2003-08-13
  • 打赏
  • 举报
回复
http://www.codeproject.com/useritems/pdfconverternet.asp?target=pdf
ecstar 2003-08-13
  • 打赏
  • 举报
回复
xpdf@cnnb.net

有什么问题可以联系我
ecstar 2003-08-13
  • 打赏
  • 举报
回复
shell 方式调用不可以吗?

如果非要控件之类的可以看看itextsharp
lxd1979 2003-08-01
  • 打赏
  • 举报
回复
没有人吗
lxd1979 2003-08-01
  • 打赏
  • 举报
回复
ziding
  • 打赏
  • 举报
回复
不知道,帮你顶!

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧