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

PrinterDevice always nil!

edited October 2005 in General
Dear RB-Team,

My goal is to have an additional button in a custom preview which prints
only the currently
displayed page.

So far I managed to create a custom preview, added that button (looks really
nice)
found your example about printing only defined pages (0124 or so,
ppTexxtToPageList)
with a PageList and PrinterDevice.PageList

...but I constantly fail to obtain the --> PrinterDevice <-- from
somewhere... :((


I even found a posting from 2000 where Tom Ollar suggests this:

component...


I tried to get a Device in both, the BeforePrint event of the originated
ReportComponent
AND the custom Preview BeforePrint-event - alas, PrinterDevice stays nil in
each case.

Can you please provide a solution or tip how I can print only one page from
a preview?

thanks very much,
best regards

harald

Comments

  • edited October 2005
    Hi Harald,

    For furture reference we prefer you use you name as the recipient when
    making a post.

    My suggestion in your case is to create the printer device yourself after
    your custom print button has been pressed. This way you will have complete
    control which pages are sent and when it is printed. Remember though that
    you will need to disconnect the screen device before making the call to
    PrintToDevices. Something like the following.

    uses
    ppPrnDev;

    ...

    var
    lPrinterDevice: TppPrinterDevice;
    begin

    lPrinterDevice := TppPrinterDevice.Create(nil);

    try
    lPrinterDevice.Publisher := ppReport1.Publisher;

    //Assign the printer device page list.

    //disconnnect screen device...
    ppReport1.ScreenDevice.Publisher := nil;

    //Print
    ppReport1.PrintToDevices;

    finaly
    ppReport1.ScreenDevice.Publisher := ppReport.Publisher;
    lPrinterDevice.Free;
    end;
    end;



    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.