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

Using escape commands through RP

edited July 2005 in General
Does anyone have any experience using escape commands from within RB?
Specifically the problem I'm having is that I can't seem to inject commands
into the middle of the print stream. It's as if RB is eating them.

I'm basically using the TppReport.Printer.Canvas.Handle and the windows
escape function to send the commands. I'm fairly certain the commands
themselves are good because if I use the Printers.Printer.Canvas.Handle they
work fine except that they print as separate documents.

Report Builder 6.0.3 Professional

Preston

Comments

  • edited July 2005

    We do not have any examples, but it is definitely doable. I have
    corresponded with customers who have implemented this.

    ReportBuilder is not 'eating' any of your calls. ReportBuilder issues
    commands to Begin/End the print job and Start/End each page. It has no
    awareness of any calls that you make.

    Perhaps its a timing of issue. Perhaps the printer only responds to calls
    when they are made at specific times during the print process. I do not know
    about escapes, but I know using windows DevMode to control the printer works
    in this manner.




    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2005
    Assuming timing is the issue, at what point should I try to run my escape
    command. For example, should I put a variable on the report and then do the
    escape in its OnPrint event?
  • edited July 2005
    I've since gotten RB to pass the escape command. The problem now is that
    it's always at the start of the print job. It doesn't matter where I do the
    escape command it does not get put in the middle of the print job. I've
    tried VarriableOnPrint, DetailBandAfterPrint, and FooterBandBeforePrint.
    They all behave the same.

    What event would I use to ensure that my escape command appears where I
    expect it to in the RB print job.
  • edited July 2005


    When printing to the printer, Report.PrinterDevice will be non nil. You
    might trying using its OnStartPage or OnEndPage events. You have to assign
    these in the Report.BeforePrint event.

    In the Report.BeforePrint event....

    if (myReport.PrinterDevice <> nil) then
    myReport.PrinterDevice.OnStartPage := myPrinterDevice_StartPageHandler;

    See RBuilder\Source\ppPrnDev.pas




    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2005
    Hi Nard,

    Assuming that this works. This will basically limit me to these particular
    events correct? There isn't anyway to drop a variable on the report and get
    the escape command to occur at that point?

    Also, I've sent the hex dump to the printer manufacturer and they've
    confirmed that the escape code is being pushed to the front of the print job
    by the software creating the print job (which would be RB).

    You mentioned you have some clients that are successfully doing this. Would
    you mind asking them how they're doing it?

    Preston


  • edited July 2005
    I got it figured out with some help from STARMicronics and Marc Antheunis.

    Here what I think (my opinion) was going on. I was using the Raster driver
    which converts everything to a bmp. Windows was seeing my escape command and
    was moving in front of the raster block because how do you convert a escape
    command to a BMP and still have it work.

    I've since installed a LineMode driver which allows me to use the control
    font. I've got a problem with that but will start a separate thread.

    Thanks for the help.
  • edited April 2006
    Can you show what parameters you are using with Escape API function ? I
    a trying to do the same thing here.

    regards,

    Carlos MacLeod

  • edited April 2006

    Here is a downloadable example.

    www.digital-metaphors.com/tips/PrinterEscapeCommands.zip

    (Thanks to Sher Hurlburt who sent an example to me yesterday, which I used
    to create this downloadable example.)




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.