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

Refresh printer list

edited October 2006 in End User
Before the call of dialog of choice of printer I need to renew the list
of printers. After it the second attempt of seal results in an error.
Reason is in irrelevance of description of printer. To correct a
situation I was able so:

ppDevice.pas
------------
...?
procedure TppPublisher.ReceivePage(aPage: TppPage);
var
lParams: TraParamList;
begin

{+} // late initializing of printer drivers for
// Citrix metafarme of user session:
if (aPage <> nil) and (aPage.PrinterSetup <> nil) then
// ( aPage.PrinterSetup.FPrinterInfo :=
// ppPrinters.PrinterInfo[aPage.PrinterSetup.FPrinterName]; )

aPage.PrinterSetup.AssignJobDef(aPage.PrinterSetup);

// BreakPoint: aPage.PrinterSetup.PrinterInfo <>
// pPrinters.PrinterInfo[aPage.PrinterSetup.PrinterName]
{+.}

{add page to cache}
AddPageToCache(aPage);
...

ppProd.pas
-----------
...
procedure TppProducer.PrintToDevices;
begin

if FBackgroundPrintSettings.Active and (DeviceClass <> TppScreenDevice)
then
PrintInBackground
else
begin

try
{+} // late initializing of printer drivers for
// Citrix metafarme of user session:
// ( PrinterSetup.FPrinterInfo :=
// ppPrinters.PrinterInfo[PrinterSetup.FPrinterName]; )

PrinterSetup.AssignJobDef(PrinterSetup);

// BreakPoint: PrinterSetup.PrinterInfo <>
// ppPrinters.PrinterInfo[PrinterSetup.PrinterName]
{+.}

InitializeReport;
...



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited October 2006

    - RB has a global singleton instance of the TppPrinterList class that can be
    accessed via the ppPrinters function.

    - RB caches the list of installed printers, call the TppPrinterList.Refresh
    method to rebuild the list.

    Example:

    uses
    ppPrintr;

    begin

    ppPrinters.Refresh;

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2006
    But in the case of work through Citrix initializing(additions) of printer
    is possible after the start of appendix. Therefore I cause the code of
    ppPrinters.Refresh by hand. But if at first to print a report, and then
    repeatedly to cause ppPrinters.Refresh, references to the printers will
    become incorrect and there will be AV at the repeated print.



    --- posted by geoForum on http://delphi.newswhat.com
  • edited October 2006

    Please post using your real name. Thanks in advance for following the
    newsgroup guidelines.

    http://www.digital-metaphors.com/support/newsgroups.html


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.