【问题标题】:How to combine 2 base64binary PDF files into Single PDF?如何将 2 个 base64binary PDF 文件合并为单个 PDF?
【发布时间】:2014-01-17 16:22:51
【问题描述】:

在我的应用程序中,我正在使用一些 web 服务,它返回一个base64binary 格式的 pdf 文件。在我的代码中,我将此文件作为byte[] 获取。

我的问题是如何将 2 个byte[] 合并为一个并将其正确存储为 pdf?

到目前为止,我分别存储每个 pdf 文件:

byte[] bytes = image.ImageData; // WebService that returns base64binary as byte[]
System.IO.FileStream stream = new FileStream(@"C:\Test\" + "File_" + i + ".pdf", FileMode.CreateNew);
System.IO.BinaryWriter writer = new BinaryWriter(stream);
writer.Write(bytes, 0, bytes.Length);
writer.Close();

【问题讨论】:

  • 你需要一个 pdf 库。

标签: c# pdf base64 bytearray filestream


【解决方案1】:

或者,您可以将它们保存为单独的 pdf 并使用 iTextSharp 合并两个 pdf...

下面的问题中提供了示例代码

Merging multiple PDFs using iTextSharp in c#.net

【讨论】:

  • 谢谢。这不是我想要的,但它很好。这意味着我将执行多个步骤:存储所有 pdf 文件 > 将它们合并为单个文件 > 删除所有我不需要的文件
猜你喜欢
  • 1970-01-01
  • 2013-06-10
  • 1970-01-01
  • 2014-08-21
  • 2012-09-12
  • 2014-11-16
  • 2012-01-07
  • 2019-09-17
  • 1970-01-01
相关资源
最近更新 更多