I am working on a project intended to control the print flow on the network. User will not be allowed to print on the printer directly. In any case EMF spool file will be generated and parsed and then forwarded to the actual printer(any PS/PCL) printer.
For forwarding the print job , I am just taking the destination printer device context and playing the spool file on the destination printer using PlayEnhMetaFile function, so it is printing on paper. Every thing works fine up to this level.
But I am getting some problem. The output from print job forwarding and the direct printing to the printer is somewhat differ.
I want to get same out put from print job forwarding as I am getting direct printing.
For that reason I am counting RECT to play enhanced meta file on the destination printer using following formula.
float PixelsX, PixelsY, MMX, MMY;
PixelsX = (float)GetDeviceCaps( dc ,HORZRES );
PixelsY = (float)GetDeviceCaps( dc, VERTRES );
MMX = (float)GetDeviceCaps( dc, HORZSIZE );
MMY = (float)GetDeviceCaps( dc, VERTSIZE );
rect.top = (int)((float)(pEMRHeader->rclFrame.top) * PixelsY / (MMY*100.0f));
rect.left = (int)((float)(pEMRHeader->rclFrame.left) * PixelsX / (MMX*100.0f));
rect.right = (int)((float)(pEMRHeader->rclFrame.right) * PixelsX / (MMX*100.0f));
rect.bottom = (int)((float)(pEMRHeader->rclFrame.bottom) * PixelsY / (MMY*100.0f));
Here "dc is Device context for the destination printer" .
But each time I am getting somewhat big print from the printer.
It would be help me if you can look into the problem please.
0 · ·