how can i print directly to the printer

Hello,

i need help about the delphicode for direct printing a report to the printer.

the code "frReport1.showprint" takes the Output first on the Screen.
Hoe can i direct printing to the outputdevice Printer?

Many Thanks for your answer

Best Regard Carsten

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:55AM
    hi
    instead of calling showreport,
    call preparereport then call printpreparedreportdlg for print dialog or
    printpreparedreport('',1,true,frall)
    param1 str '1,3' or '5..9' or '' for all
    param2 int number of copies
    param3 boolean collate
    param4 fr constant.
    regards ;)
  • edited 2:55AM
    many thanks for your answer!

    best regards

    C.Wille

  • edited 2:55AM
    I have similar problem.
    I need to print on two different printers on same PC without prompting user to select printer. How I can, from code, select printer where to print???


    Sorry for my bad english:(

    Best regards,
    nele
  • guzialguzial Poland
    edited 2:55AM
    so you can do something like that:
    (of course it is not in FastReport but in Delphi - you can do it in BC++ too)

    if your FreeReport object name is frReport1

    frReport1.ChangePrinter(aOldIndex, aNewIndex,);
    frReport1.PrintPreparedReport('',PrintDialog1.Copies, PrintDialog1.Collate, frAll);

    where method ChangePrinter has two parameters
    1st - index of old printer
    2nd - new index

    PrintPreparedReport that method print report without dialog with user; if you use that method you have to give 4 parameters (PageNumbers: string; Copies: Integer; Collate: Boolean; PrintPages: TfrPrintPages)

    if you want to find out how much indexes of printers are availible you can use object of TPtinter (you have to add Printers to section "uses")
    than object of TPrinter for example Printer has method Printers
    so from 0 to printer.Printers.Count-1 it's range of indexes' availible in your computer

    if something is not clear you can write me guzial@wp.pl

    regards sorry for my english

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.