JAVI1065
asked on
How can I convert from PDF to tiff using ghostscript?
I need to convert some files from pdf to tiff in a vb 2005 application and I heard it's possible with ghostscript. How can I approach this. I use vb but I can translate to c# if necessary.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
apparently the following can also work from the command line.
~Alain
~Alain
gswin32c -dNOPAUSE -q -g300x300 -sDEVICE=tiffg4 -dBATCH -sOutputFile=output_file_name.tif input_file_name.pdf
Here's more code that claims it can do the same using ghostscript in powershell:
~Alain
~Alain
$tiff = $pdf.FullName.split('.')[0] + '.tiff'
if(test-path $tiff)
{
"tiff file already exists " + $tiff
}
else
{
'Processing ' + $pdf.Name
$param = "-sOutputFile=$tiff"
& $tool -q -dNOPAUSE -sDEVICE=tiffg4 $param -r300 $pdf.FullName -c quit
}
Here is a simple C# GS wrapper to convert PDF to JPEG which can easily be modified for TIFF:
http://www.mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/
Change the sDevice arg from jpeg to tiffg4 (assuming you want black & white). Lose dTextAlphaBits & dGraphicsAlphaBits. You can use the -r arg to adjust dpi.
http://www.mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/
Change the sDevice arg from jpeg to tiffg4 (assuming you want black & white). Lose dTextAlphaBits & dGraphicsAlphaBits. You can use the -r arg to adjust dpi.
ASKER
I had to change of program
If it doesn't work then maybe ghostscript just can't do it.
~Alain
Open in new window