在webform C#中将pdf,doc和excel文件转换为jpg [英] Convert pdf, doc and excel file to jpg in webform C#

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

问题描述

我想将多个文件扩展名pdf,doc或excel转换为网页形式的jpg。

请帮助我!你发送给我源代码真是太好了。

非常感谢!

I want to convert many file extension pdf,doc or excel to jpg in web form.
Please help me! It's very kind of you sendding me source code.
Thanks a lot!

推荐答案

你好,



我不确定是否存在这样的工具。但是,您可以使用图像打印机驱动程序,然后通过命令行界面使用相应的软件自动将文件打印到图像打印机。我绝对不会建议通过ASP.NET使用命令行。但是,您可以执行一个简单的数据库支持的作业计划,以在后台执行此操作。然后,您可以为最终用户提供单独的视图页面。高级工作流程将是。



1.用户使用网络表单提交文件

2.在服务器上生成一个唯一的名称和通过此名称将文件存储在专用存储区域中

3.在具有原始文件名的作业表中插入记录,并生成唯一ID和处理标志为N和文件类型(excel,单词,pdf等)。

4.显示生成的唯一ID,以便用户稍后可以查询作业状态。



在后台服务中将发生以下事件



1.从数据库表中检索待处理的作业(已处理的标志='N')

2.对于每个作业记录,从文件类型中找出外部程序。

3.构造命令行进行打印,例如对于pdf文件,您可以使用以下命令行



Hello,

I am not sure whether there exists such a tool. However you can have a image printer driver and then use the respective softwares via commandline interface to automate the printing of the files to the image printer. I definitely won't recommend use of command line via ASP.NET. You can however do a simple database backed job schedular to achive this in background. You can then provide a seperate view page to the end user. The highlevel workflow wwold be.

1. User uses web form to submit the file
2. On the server generate a unique name and store the file in a dedicated storage area by this name
3. Insert a record in a job table with original file name and generated unique id and processd flag as 'N' and the file type (excel, word, pdf etc).
4. Show the generated unique id using which user will be able to query the job status later on.

In the background service following events will occurr

1. Retrieve the pending jobs from database table (processed flag = 'N')
2. For every job record find out the external program from the file type.
3. Construct a command line to do the printing e.g. for pdf file you can use following command line

AcroRd32.exe /N /T PdfFile PrinterName [ PrinterDriver [ PrinterPort ] ]





4.使用代码项目成员创建的libray Xianggyang Liu 执行上述命令行。

5.根据打印结果,您可以将作业更新为成功或错误。



问候,

Prasad P. Khandekar


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

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