How to print something using x,y in millemeters?

Please discuss general Delphi programming topics here.

How to print something using x,y in millemeters?

Postby Gil » November 24th, 2003, 12:07 pm

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;
Gil
Member
Member
 
Posts: 4
Joined: October 24th, 2003, 3:34 pm

Postby tomu » January 5th, 2004, 3:59 pm

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.
tomu
Member
Member
 
Posts: 1
Joined: January 5th, 2004, 3:54 pm


Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest