Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: How to skip print dialog and print to default printer  (Read 4680 times)

davidovv

  • Newbie
  • *
  • Posts: 11
    • View Profile
How to skip print dialog and print to default printer
« on: March 07, 2017, 03:43:37 pm »
When executing ReportEngine::printReport() the dialog shows for selection of the printer and additional print button click
How can I skip his dialog and print directly to default printer?

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: How to skip print dialog and print to default printer
« Reply #1 on: March 08, 2017, 03:44:05 am »
You can pass the printer as an argument to the function ReportEngine::printReport(QPrinter * printer = 0)

andretisch

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to skip print dialog and print to default printer
« Reply #2 on: June 23, 2022, 10:37:00 am »
Не бейте ногами, но я больше на питоне пишу. Как послать аргумент в эту функцию?

Subst

  • Sr. Member
  • ****
  • Posts: 450
    • View Profile
Re: How to skip print dialog and print to default printer
« Reply #3 on: July 11, 2022, 08:33:26 am »
Послать аргумент куда? Не вполне понятен вопрос..
сюда?

ReportEngine::printReport(QPrinter * printer = 0)

как-то так, наверное

LimeReport::ReportEngine *m_report=new LimeReport::ReportEngine(this);
m_report->loadFromFile(path_to_template);
m_report->printReport(new QPrinter(QPrinterInfo::defaultPrinter());

andretisch

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to skip print dialog and print to default printer
« Reply #4 on: September 20, 2022, 05:08:25 pm »
Спасибо, я решил несколько иначе, я передаю имя принтера, что позволяет печатать разные отчеты на разные принтеры используя conf файл

Quote
QPrinter printerLS;
printerLS.setPrinterName(printerLS.printerName());
LimeReport::ReportEngine reportLS;
if (varItem.at(0) == "printerLS"){printerLS.setPrinterName(varItem.at(1));}
reportLS.printReport(&printerLS);