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

How do you send codes to the printer within a report

edited April 2003 in General
In Microsoft Word you can embed printer codes within a Word document. How
can you do this in Report Builder?

The example I have in word has:
{PRINT \p page" gsave initgraphics (/var/spool/fhsback.tif) GetTiff
grestore"\p page \*MERGEFORMAT}

I think this merges a tif image into the document while the document is
printing.

Thanks for you help.

Comments

  • edited April 2003
    Hi jmm,

    your example doesn't show any printer code, and I doubt you can do it with Word.
    What do you want to achieve?

    regards,
    Chris Ueberall;
  • edited April 2003
    I would like to insert postscript commands into our reports. These commands
    would merge tif images, that are stored on the printer into the report. We
    will be using this mostly to insert signatures into letters.

    To do this in Word open a blank document, click insert, field..., set
    categories to document automation and field names to print. Click ok. At
    this point you can enter postscript commands between the PRINT and the /*
    that the printer will interpret when the document is printed.

    I would like to do the same thing with report builder. Any Ideas?

  • edited April 2003
    jmm,

    You will need to write your report with the ESC code included to a text
    file, and then send the text file to the printer for any print commands to
    work. See Demo 107 in the \RBuilder\Demos\1. Reports\... folder for an
    example of writing a report to a text file. Below is an example showing how
    to then send a text file to the printer.


    -----------------------------------------------
    Tech Tip: Send TextFile to Printer
    -----------------------------------------------

    I designed a application that exports the report to a .txt
    file using ReportTextFile device.

    How can I Send the text file to the printer?

    The following procedure will send the .txt file to
    the printer using Delphi's TPrinter object.



    uses
    Printers;


    procedure SendTextFileToPrinter(aFileName: String);
    var
    lsLines: TStringList;
    lOutputFile: TextFile;
    liIndex: Integer;
    begin

    lsLines := TStringList.Create;

    try
    lsLines.LoadFromFile(aFileName);

    AssignPrn(lOutputFile);
    Rewrite(lOutputFile);

    for liIndex := 0 to lsLines.Count-1 do
    Writeln(lOutputFile, lsLines[liIndex]);

    CloseFile(lOutputFile);

    finally
    lsLines.Free;
    end;


    end;


    --
    Best Regards,

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