Can anyone tell me what I’m doing wrong here? I’m trying to make a
formatted .phs file from a PhImage_t data structure that will eventually
be sent to the printer. I can create a bitmap or JPEG from the image
data, but the following produces a .phs file with nothing in it but
filter information:
int print(PhImage_t *image)
{
int iErrCode = 0;
PhDrawContext_t pdc = 0;
PpPrintContext_t mpPC;
PhPoint_t p = { 0, 0 };
mpPC = PpCreatePC();
if (mpPC)
{
// set up my context
if(!iErrCode)
{
PpSetPC(mpPC, Pp_PC_DRIVER, “/usr/bin/phs-to-ps”, 0);
PpSetPC(mpPC, Pp_PC_FILENAME, “grabscreen.phs”, 0);
Ph_rect xPrintArea;
xPrintArea.ul.x = 750;
xPrintArea.ul.y = 500;
xPrintArea.lr.x = 500;
xPrintArea.lr.y = 400;
PpSetPC(mpPC, Pp_PC_MARGINS, &xPrintArea, 0);
PhDim_t xPaperSize;
xPaperSize.w = 8500;
xPaperSize.h = 11000;
PpSetPC(mpPC, Pp_PC_PAPER_SIZE, &xPaperSize, 0);
PhDim_t xSourceSize;
xSourceSize.w = 725;
xSourceSize.h = 1010;
PpSetPC(mpPC, Pp_PC_SOURCE_SIZE, &xSourceSize, 0);
}
// initialize the print job
if(!iErrCode)
{
if(PpStartJob(mpPC))
iErrCode = 2;
}
// make the print context active
if(!iErrCode)
{
pdc = PpContinueJob(mpPC);
if(!pdc)
iErrCode = 3;
}
if (image == NULL)
{
cout << “ERROR: NULL image” << endl;
exit(1);
}
PgSetPalette( image->palette, 0, 0, image->colors,
Pg_PALSET_SOFT, 0 );
PgDrawImage( image->image, image->type, &p,
&image->size, image->bpl, 0 );
PpEndJob(mpPC);
PpReleasePC(mpPC);
}
}