Page 1 of 1

do not change the default printer

Posted: Mon Oct 05, 2015 9:34 am
by rellik
I linked TSrvPrint with TSRichViewEdit.

Than I call TPrintDialog, CHANGE DEFAULT PRINTER and do

SRVPrint1.Print('', PrintDialog1.Copies, PrintDialog1.Collate);

But prints ONLY occurs on the default printer.

So, I can't change the default printer by standart printer dialog.

Posted: Mon Oct 05, 2015 10:49 am
by Sergey Tkachenko
Sorry, I cannot reproduce this problem.
In my test, SRVPrint prints on the chosen printer.

I tested in the demo Demos\SRVPrint\PM_Auto\

Test 1

I added a new button in this demo, and assigned in its OnClick:

Code: Select all

SRVPrint1.Print('test', 1, False);
This demo allows choosing a printed from a combo box. When user chooses a printer, the demo assigns Printer.PrinterIndex.
Result: the demo prints on the printer chosen in the combo box, as expected.

Test 2
I placed TPrintDialog on this form, and modified the code in OnClick:

Code: Select all

  if PrintDialog1.Execute then begin
    // we should also assign cmbPrinter.ItemIndex := Printer.PrinterIndex;
    // but I did not do it to make sure that the printer is changed only by TPrintDialog
    UpdateControlsForPrinter;
    SRVPrint1.Print('test', 1, False);
  end;
Result: the demo prints on the printer chosen in the dialog, as expected.

Posted: Mon Oct 05, 2015 11:54 am
by rellik
Sergey Tkachenko wrote:
Sorry, Sergey! I'ts my fault, I used TdxPrintDialog, not standart :oops: