Home > Back-end >  BCB using XPS virtual printer and the real printing effect is not the same
BCB using XPS virtual printer and the real printing effect is not the same

Time:10-18

In order to achieve the data in a form template to print, design thought is: the first printing templates, to make the text data to print to the corresponding position of the template,
The following is a part of the code
//use the bitmap to template printed
Start printing
.
.
Printer1 - & gt; Canvas - & gt; BrushCopy (MyRect, Bitmap, MyRect, clBlack);
.
.
//and then on to the bitmap print text
Printer1 - & gt; Canvas - & gt; TextOutA (Width, Height, date printing "");
.
.
End of print

Results: on the XPS virtual printer to print out the effect of the expected effect, but on the real printer to print out the effect of the templates location deviation occurs, text location data is right, this is going on here? Solving, haven't got the embarrassed of only 10 points,

CodePudding user response:

XPS is displayed in the display of the above, the actual printer resolution is not so high, so there are deviation,

Looking for a display and a printer resolution, of course, is the same, then the output, income, should be seen is

Sp=Screen - & gt; PixelsPerInch;
//display
Px=GetDeviceCaps (GetWindowDC (GetDesktopWindow ()), LOGPIXELSX);
P y=GetDeviceCaps (GetWindowDC (GetDesktopWindow ()), LOGPIXELSY);
//printer
Px=GetDeviceCaps (Printer () - & gt; Handle, LOGPIXELSX);
P y=GetDeviceCaps (Printer () - & gt; Handle, LOGPIXELSY);

CodePudding user response:

Adversary, resolution and paper size and margins are the same
  • Related