January 18th, 2011, 01:42 PM
Converting TIF images to PDF by passing .exe file with its aruments
I have one .exe file which converts *.tif images into *.pdf file. And i have one class library where i need to pass this .exe file with its arguments. Here arguments i need to pass are scalesector, outputpath (path to generate pdf file) and inputpath (path where tif image exists).
Here i have big tif images like its height will be more than 60,000. So i need to achieve it in C#.
I have written the code as below.
But i am unable to get the PDF in output directory. What may be the problem?
When i checked Output directory will be empty.
private void converttopdf()
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "E:\\pdfbigimage_src\\Debug\\pdfbigimage.exe";
startInfo.Arguments = "-s 0.4 -o E:\\output\\out9.pdf E:\\Input_Images\\SI00004623\\2010026567_001.tif";
startInfo.Verb = null;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
February 5th, 2011, 01:28 AM
Re: Converting TIF images to PDF by passing .exe file with its aruments
Nothing seems obviously wrong with your code (to my single read through), but that doesn't mean something isn't wrong (since obviously it is: it doesn't work :-)).
More realistically though, using C# for this task is a bit overkill. I recommend you use either batch programming (if you're using windows) or shell scripting (if a linux-like environment).
Resource for batch files: http://www.ericphelps.com/batch/
It isn't very hard to learn and it's a handy tool to have available. You know what they say... when all you have is C#, everything looks like ... problem that can be solved by C#.. (erm.. right?)
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!