Page 1 of 1

How to print something using x,y in millemeters?

PostPosted: November 24th, 2003, 12:07 pm
by Gil
I'm printing bar codes, but under each bar code I need to print a label...

the barcode can be printed using x,y in millimeter... but the label i can not... How can I do it ??? What is the value of 1millimeter in pixels ??


My code:

Code: Select all
with Printer do
  begin
    BeginDoc;
      DBBarcode1.Print(utMillimeter, posX, posY, 15, 0.2, 0);
      Canvas.Font.Name := 'Arial';
      Canvas.Font.Size := 8;
      Canvas.Font.Style := [fsBold];
      Canvas.TextOut(labelX, labelY, 'Perda de Garantia Se Removido');
    EndDoc;
  end;

PostPosted: January 5th, 2004, 3:59 pm
by tomu
You may need to use the Windos API instead of Delphi's Canvas.
Use the Canvas.Handle with API calls like SetMapMode(Canvas.Handle ,MM_HIMETRIC) and
TextOut(Canvas.Handle,2,2,'123',3); to print '123' 2 mm down and over.