Q:  How can I send a PostScript file directly to the WindowServer?

A: You should usually use NXImage.  However, if that's not appropriate in your situation use the following code snippet.  Warning: Do not use PSRun(), because your application may not work with -NXHost since the file you specified may not exist on the other machine.

int SendFileToPS(const char *fileName)
{
NXStream *st;
char *addr;
int len, maxlen;

st = NXMapFile(fileName, NX_READONLY);
if (st) {
NXGetMemoryBuffer(st, &addr, &len, &maxlen);
DPSWriteData(DPSGetCurrentContext(), addr, len);
NXCloseMemory(st, NX_FREEBUFFER);
return 0;
} else
return -1;
}



QA798

Valid for 1.0, 2.0, 3.0, 3.1