Richard yu 2012-02-27 23:54:27
I am using this sample code,
/* Example of using GS DLL as a ps2pdf converter. */
/* Compile with:
* cl -D_Windows -Isrc -Febin\ps2pdf.exe ps2pdf.c bin\gsdll32.lib
#define GSDLLEXPORT __declspec(dllimport)
int main(int argc, char *argv)
const char * gsargv;
gsargv = “ps2pdf”; /* actual value doesn’t matter */
gsargv = “-dNOPAUSE”;
gsargv = “-dBATCH”;
gsargv = “-dSAFER”;
file://gsargv = “-sDEVICE=pdfwrite”;
gsargv = “-sDEVICE=Xerox Phaser 8200DX”;
gsargv = “-sOutputFile=out.pdf”;
gsargv = “-c”;
gsargv = “.setpdfwrite”;
gsargv = “-f”;
gsargv = “input.ps”;//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); gsapi_exit(minst); gsapi_delete_instance(minst); // 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.
Quite 2012-02-27 23:54:35
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 email@example.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don’t e-mail them.
Richard yu 2012-02-27 23:54:37
if not use GS, are there other ways to send postscript command to a PS
printer in C ?
Richard yu 2012-02-27 23:54:40
there is another way to send PS to printer, didn’t try it yet.
John doherty 2012-02-27 23:54:48
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. —
Peter billam 2012-03-08 22:03:31
If you only have Windows, you could try
Regards, Peter Billam
Peter Billam www.pjb.com.au peter.billam at pjb.com.au
Original compositions, and arrangements of Bach, Schubert, Brahms…