Visite Webhosting Latino, el site sobre alojamiento web.
how to set -sDEVICE param ? - Mombu the Programming Forum
Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > how to set -sDEVICE param ?
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 28th February 01:54
richard yu
External User
Posts: 1
Default how to set -sDEVICE param ?

I am using this sample code,

/* Example of using GS DLL as a ps2pdf converter. */

#ifdef _Windows
/* Compile with:
* cl -D_Windows -Isrc -Febin\ps2pdf.exe ps2pdf.c bin\gsdll32.lib
#include <windows.h>
#define GSDLLEXPORT __declspec(dllimport)

#include "errors.h"
#include "iapi.h"

gs_main_instance *minst;

int main(int argc, char *argv[])
int code;
int exit_code;
const char * gsargv[10];
int gsargc;
gsargv[0] = "ps2pdf"; /* actual value doesn't matter */
gsargv[1] = "-dNOPAUSE";
gsargv[2] = "-dBATCH";
gsargv[3] = "-dSAFER";
file://gsargv[4] = "-sDEVICE=pdfwrite";
gsargv[4] = "-sDEVICE=Xerox Phaser 8200DX";
gsargv[5] = "-sOutputFile=out.pdf";
gsargv[6] = "-c";
gsargv[7] = ".setpdfwrite";
gsargv[8] = "-f";
gsargv[9] = "";//this is the default testing PS file

code = gsapi_new_instance(&minst, NULL);
if (code < 0)
return 1;
code = gsapi_init_with_args(minst, gsargc, gsargv);


// if ((code == 0) || (code == e_Quit))
// return 0;
return 1;

with "-sDEVICE=pdfwrite setting, it can convert ps to pdf,

I want to send that ps file to my printer, don't how to set all the argv,
my printer is Xerox Phaser 8200DX on a LAN,

when I run the code, it says "unknown device Xerox Phaser 8200DX", don't
know what name should be set here, and all the argv settings.
  Reply With Quote

  sponsored links

2 28th February 01:54
External User
Posts: 1
Default how to set -sDEVICE param ?

That is a PostScript printer. Why would you want to use GhostScript?

I think you have the role of GhostScript confused, to be honest. It is
not a print spooler.
Aandi Inston
Please support usenet! Post replies and follow-ups, don't e-mail them.
  Reply With Quote
3 28th February 01:54
richard yu
External User
Posts: 1
Default how to set -sDEVICE param ?

if not use GS, are there other ways to send postscript command to a PS
printer in C ?
  Reply With Quote
4 28th February 01:54
richard yu
External User
Posts: 1
Default how to set -sDEVICE param ?

there is another way to send PS to printer, didn't try it yet.
  Reply With Quote
5 28th February 01:54
john doherty
External User
Posts: 1
Default how to set -sDEVICE param ?

Well, that would depend on how the printer is connected to the host
running the C program. If the connection is serial (e.g., RS-232),
you can pretty much write characters to it more or less as if it
were stdout, although the details will be platform-specific. If it's
a network connection, things could be considerably more complicated
and quite certainly platform-specific.

If your platform happens to be unix, it would probably be best to take
advantage of the lp subsystem. Again, your C program won't have to do
too much more than write characters as if it were writing them to stdout.
W. Richard Stevens' "Advanced Programming in the UNIX Environment"
[ISBN 0-201-56317-7] has a chapter devoted to "Communicating with a
PostScript Printer" that you might find helpful.

As Aandi suggested, ghostscript is not a print spooler, and serves little
or no purpose when the printer has a PostScript interpreter.

But lp *is* a print spooler, and one that's quite capable of working with
PostScript printers. --
  Reply With Quote
6 9th March 00:03
peter billam
External User
Posts: 1
Default how to set -sDEVICE param ?

If you only have Windows, you could try

Regards, Peter Billam


Peter Billam peter.billam at
Original compositions, and arrangements of Bach, Schubert, Brahms...
  Reply With Quote

Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -