Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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!
Posted
Updated 22-Nov-11 4:10am
v2

1 solution

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. Use a libray created by code project member Xiangyang Liu to execute the above command line.
5. Depending upon the outcome of the printing you can update the job as either success or error.

Regards,
Prasad P. Khandekar
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900