将pdf文件转换为C#中的文本 [英] Convert a pdf file to text in C#

查看:130
本文介绍了将pdf文件转换为C#中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将.pdf文件转换为.txt文件(或.doc,但我更喜欢.txt).

I need to convert a .pdf file to a .txt file (or .doc, but I prefer .txt).

如何在C#中执行此操作?

How can I do this in C#?

推荐答案

Ghostscript 可以做你所需要的.以下是用于将pdf文件中的文本提取到txt文件中的命令(您可以从命令行运行它以测试它是否适合您):

Ghostscript could do what you need. Below is a command for extracting text from a pdf file into a txt file (you can run it from a command line to test if it works for you):

gswin32c.exe -q -dNODISPLAY -dSAFER -dDELAYBIND -dWRITESYSTEMDICT -dSIMPLE -c save -f ps2ascii.ps "test.pdf" -c quit >"test.txt"

在此处检查:代码项目:使用Ghostscript API将PDF转换为图像如何在C#中使用ghostscript的详细信息

Check here: codeproject: Convert PDF to Image Using Ghostscript API for details on how to use ghostscript with C#

这篇关于将pdf文件转换为C#中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆