Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 540775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:16:30+00:00 2026-05-13T10:16:30+00:00

These are the steps I am trying to achieve: Upload a PDF document on

  • 0

These are the steps I am trying to achieve:

  1. Upload a PDF document on the server.
  2. Convert the PDF document to a set of images using GhostScript (every page is converted to an image).
  3. Send the collection of images back to the client.

So far, I am interested in #2.

First, I downloaded both gswin32c.exe and gsdll32.dll and managed to manually convert a PDF to a collection of images(I opened cmd and run the command bellow):

gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -sOutputFile=image_%d.jpg somepdf.pdf

Then I thought, I’ll put gswin32c.exe and gsdll32.dll into ClientBin of my web project, and run the .exe via a Process.

System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.WorkingDirectory = Request.MapPath("~/");
process1.StartInfo.FileName = Request.MapPath("ClientBin/gswin32c.exe"); 
process1.StartInfo.Arguments = "-dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -sOutputFile=image_%d.jpg somepdf.pdf"
process1.Start(); 

Unfortunately, nothing was output in ClientBin. Anyone got an idea why? Any recommendation will be highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:16:30+00:00Added an answer on May 13, 2026 at 10:16 am

    I’ve tried your code and it seem to be working fine. I would recommend checking following things:

    1. verify if your somepdf.pdf is in the working folder of the gs process or specify the full path to the file in the command line. It would also be useful to see ghostscript’s output by doing something like this:

      ….
      process1.StartInfo.RedirectStandardOutput = true;
      process1.StartInfo.UseShellExecute = false;
      process1.Start();
      // read output
      string output = process1.StandardOutput.ReadToEnd();
      …
      process1.WaitForExit();
      …

      if gs can’t find your file you would get an “Error: /undefinedfilename in (somepdf.pdf)” in the output stream.

    2. another suggestion is that you proceed with your script without waiting for the gs process to finish and generate resulting image_N.jpg files. I guess adding process1.WaitForExit should solve the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say,how to implement these three steps: 1.fetch a html source from server side 2.use
I am trying to convert some code from using DOM (via jDOM) to use
I am trying to install mongodb on my system and following these steps( http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
In trying to create a custom build for an application, I followed these steps
What I'm trying to achieve: At the moment, I have a UIImagePickerController set up
I have been trying to achieve ClickOnce deployment using MSBuild scripts, but I could
I'm doing these steps: Create new vs2010 C# console application Project menu -> Add
After following these steps: http://developers.facebook.com/docs/mobile/android/build/ I find that everything goes well, but when I
I found a strange ToolStripButton double click problem. These steps will reproduce the problem:
The loop for root, dir, file in os.walk(startdir) works through these steps? for root

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.