TAdvStringGrid.PrivatePrintRect
assumes that printing has started as soon as Printer.BeginDoc
has been called.
But if a PDF printer is used (set as system's default), Printer.BeginDoc
will lead to a filename dialog showing up, at first.
If that dialog gets cancelled by the user, TAdvStringGrid.PrivatePrintRect
continues anyway and an EPrinter
exception "Printer is not printing" is thrown in VCL.Printers as a result.
Instead we would expect that printing is just cancelled silently, without an exception.
TPrinter.BeginDoc
resets its printing flag/property FPrinting
, if the dialog has been cancelled. So probably the flag just needs to be checked another time, after calling BeginDoc
.