c# - pdf 到 word 编程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2083387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 23:22:58  来源:igfitidea点击:

c# - pdf to word programmatically

c#pdfms-word

提问by Peanut

Does anyone know of a good solution for converting PDF files to a word .doc files (not docx) programmatically? I've tried SautinSoft's solution but even though it does the job, it's not the best quality.

有谁知道以编程方式将 PDF 文件转换为 word .doc 文件(不是 docx)的好解决方案?我已经尝试过 SautinSoft 的解决方案,但即使它可以完成工作,它的质量也不是最好的。

采纳答案by yu-chen-pdfonline-com

We offer a solution called EasyConverter SDK that you may wish to give a try:

我们提供了一个名为 EasyConverter SDK 的解决方案,您不妨尝试一下:

http://www.pdfonline.com/easyconverter/sdk/index.htm

http://www.pdfonline.com/easyconverter/sdk/index.htm

If you want to get a quick idea of what the results would look like before trying the evaluation version, you can use the online converter here first:

如果您想在试用评估版之前快速了解结果是什么样的,您可以首先使用此处的在线转换器:

http://www.pdfonline.com/pdf2word/index.asp

http://www.pdfonline.com/pdf2word/index.asp

There are indeed many considerations when converting a mostly static format like PDF to Word. EasyConverter SDK works nicely for most business documents while marketing documents (which typically utilize fancier layouts) are usually more challenging.

将 PDF 等大部分静态格式转换为 Word 时确实需要考虑很多因素。EasyConverter SDK 适用于大多数业务文档,而营销文档(通常使用更漂亮的布局)通常更具挑战性。

回答by Pindatjuh

As in "solution", a way to do it, probably, but you'd have to digg into this yourself:

就像在“解决方案”中一样,可能有一种方法可以做到,但是您必须自己深入研究:

The PDF file format is... quite hard to understand. First of all, it can't be compared to Word format at all. It's format is designed to produce a consistent look on all platforms and printers, Word therein, is a little less strict.

PDF 文件格式是……很难理解。首先,它根本无法与Word格式相提并论。它的格式旨在在所有平台和打印机上产生一致的外观,其中的 Word 不太严格。

Editing PDF files, first, is quite hard too: because you don't have "text" like in Word; it's more like chunks of letters. These are all positioned individually.

首先,编辑 PDF 文件也非常困难:因为您没有 Word 中的“文本”;它更像是大块的字母。这些都是单独定位的。

The only doablesolution I see is the following:

我看到的唯一可行的解决方案如下:

  1. Render the PDF to an image. (Thus requires a PDF rendering library!)
  2. Append this image into a .doc. (Thus requires a .DOC writing library!)
  1. 将 PDF 渲染为图像。(因此需要一个 PDF 渲染库!)
  2. 将此图像附加到.doc. (因此需要一个 .DOC 编写库!)

I think it's what SautinSoft is doing too; that's the reason of it's bad quality. Images can get quite huge if you want good quality (i.e. you can't get the optimization like generic fonts or repeating graphics, like you have with PDF files).

我认为这也是 SautinSoft 正在做的事情;这就是它质量不好的原因。如果您想要高质量的图像,图像可能会变得非常大(即,您无法获得像通用字体或重复图形这样的优化,就像您对 PDF 文件所做的那样)。

回答by mark stephens

PDF is an 'endfile' display format so it throws away a lot of detail you would need in a word file (such as flow). There are tools out there but you are not likely to be totally happy with the results.

PDF 是一种“endfile”显示格式,因此它丢弃了您在 word 文件(例如流程)中需要的许多细节。有一些工具,但您不太可能对结果完全满意。

There is a blog post explaining the issues better at http://pdf.jpedal.org/java-pdf-blog/bid/12670/PDF-text

http://pdf.jpedal.org/java-pdf-blog/bid/12670/PDF-text 上有一篇博文更好地解释了这些问题

回答by Charles Stewart

Convert the PDF to SVG and embed the SVG in the Word document.

将 PDF 转换为 SVG 并将 SVG 嵌入 Word 文档中。