How to print a pdf file?

  • Thread starter Thread starter ywchan
  • Start date Start date
Process proc = new Process ( );
proc.StartInfo.FileName = "C:\\gs\\gs8.13\\bin\\gswin32";
proc.StartInfo.Arguments = "-dPrinted -dBATCH " +
"-dNOPAUSE -q " +
"-sDEVICE=ljet4 " +
"-sOutputFile=\"\\\\Your\\Printer\" " +
"c:\\your\\file.pdf";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start ( );

In this example, I use only ghostscript and not ghostview. Make sure you
point to where the gswin32.exe is for the FileName property.

scott
 
ywchan said:
can you tell me what is the command for printing a pdf file using ghostview?
thanks

Process proc = new Process ( );
proc.StartInfo.FileName = "C:\\gs\\gs8.13\\bin\\gswin32";
proc.StartInfo.Arguments = "-dPrinted -dBATCH " +
"-dNOPAUSE -q " +
"-sDEVICE=ljet4 " +
"-sOutputFile=\"\\\\Your\\Printer\" " +
"c:\\your\\file.pdf";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start ( );

In this example, I use only ghostscript and not ghostview. Make sure
you
point to where the gswin32.exe is for the FileName property.

Also note, that there is an API that could be used. See the docs on
the site for mor info.

scott
 
Thank you very much~~
you are very nice~~

I would like to know what is meant by "-sDevice=ljet4"?
and can your method specify to print a range of pages?
e.g. from page 2 to page 4

Thanks
 
Oh~~ I finally find out the command la
add parameter -dFirstPage and -dLastPage to specify the page range...

But I find out another problem....
use the command always give portrait orientation....
How to change the paper orientation?
Thanks
 
I have tried to change paper orientation by use '-dORIENT1',
but no matter I set it to true or false...the printed document is always
in portrait...
How to change the paper orientation to landscape?
Thanks
 
Try: -dORIENT1=true

If that still does not work try sending the landscap.ps file in your
ghostscript library directory to the ghostscript command line. Put this
file IN FRONT of the file to be printed on the same argument line.

scott
 
That tells ghostscript what type of device it is talking too. In this
case, a PLC3 based device.

scott
 
Back
Top