Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Printing on a card printer and encoding the magnetic stripe in one go?

edited February 2008 in General
Hi,

1. I can print the front side of a card with ReportBuilder without
problems.

procedure PrintCard;
begin
ppViewer1.Report := ppReport1;
ppRichText1.MailMerge := true;

{ ....load text / image ...}

// set printer name
ppReport1.PrinterSetup.PrinterName := MembershipCardPrinterName;
ppReport1.PrinterSetup.PaperName := 'Custom';
ppViewer1.Print; // Print front card
end;


2. I can also encode the magnetic track of the card by using Delphi
printer object:

procedure EncodeCard;
var
myPrinter : TPrinter;
begin
myPrinter := Printer;
myprinter.Orientation := poLandscape;
myPrinter.BeginDoc;
myPrinter.Canvas.TextOut(0, 0, '~1;445778811?#'); // encode track1
myPrinter.Canvas.TextOut(0, 0, '~2;456789123?#'); // encode track2
myPrinter.EndDoc;
end;

What I would like to achieve is to print the front side and encode the
track in one go.

I have seen a similar post and downloaded PrinterEscapeCommands.zip file
but this solution is not supported by the printer we are using (CP40
Plus DataCard printer).

There must be a way that I could combine the 2 procedures PrintCard and
EncodeCard with Report Builder in one print job?

Your advice is very much appreciated.

Regards,
Victor



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited February 2008
    Hi Victor,

    Sorry for the delayed response, I somehow lost your post within another
    thread.

    If your printer does not have the ability to accept escape codes, you may
    consider researching its custom API commands.

    -------------------------------------------------
    Tech Tip: Configuring Printer Specific Options
    -------------------------------------------------

    The Report.PrinterSetup properties can be used to set the properties that
    are common to all printers. Internally RB applies these to the Windows
    DevMode structure.


    Report.PrinterSetup <----> Windows DevMode <-----> Printer Driver <--->
    Printer


    Printers often contains additional features, such as output bins, media
    types, etc. The Windows DevMode structure can contain a private area that is
    used the printer driver to store printer specific options. These can be
    configured by using the Printer Driver's built-in properties dialog. These
    options can theoritically be set programmatically, the trick is that you
    have to know where in the structure to store the option and what values are
    valid.

    The following example shows how to display the printer properties dialog and
    save the devmode for use within RB...

    http://www.digital-metaphors.com/tips/SavePrinterDevMode.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.