vb.net - PDF from PS through Shell with gswin32c -


i trying produce "c:\output.pdf" existed , formed "output.ps" file vb.net , shell gswin32c.exe in current directory.

but can't write shell command properly:

if lcase(p_printer).contains("ghostscript")      ' not show old 1     io.file.delete(outputpdf)     if io.file.exists(inputps)         dim commandstring string = """gswin32c.exe -sdevice=pdfwrite -dnopause -dbatch -dsafer -dquiet -soutputfile=" & outputpdf & " " & inputps & """"         debug.print(commandstring)          shell(commandstring, appwinstyle.normalfocus)         if io.file.exists(outputpdf) , bln_showpdf             'show pdf             start(outputpdf)         end if     else         msgbox(inputps + " not exists.", msgboxstyle.critical)     end if end if 

from cmd window command regularly produce "output.pdf"

what incorrect , how working?

dim inputps string = "c:\temp\output.ps" 'must use 8.3 file naming convention dim outputpdf string = "c:\temp\output.pdf" 'must use 8.3 file naming convention dim commandstring string = "c:\gs\gswin32c.exe -sdevice=pdfwrite -dnopause -dbatch -dsafer -dquiet -soutputfile=" & outputpdf & " " & inputps  debug.print(commandstring) shell(commandstring, appwinstyle.normalfocus) 

actually command string doesn't need quotation marks, tested without them. must use 8.3 file naming convention though. note in code input , output filenames not start or end quotation marks; why must use 8.3 file naming convention succeed. , no spaces in file names or paths.

your problem can't find file; relying on active directory not practice can cause problems. solution provide full path , file name no spaces , using 8.3 file naming convention both path , file name.

also make sure gsdll32.dll in same folder gswin32c.exe.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -