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

printing to pdf file

edited April 2003 in End User
Hi,

I'm using ReportBuilder to print from my application. Now I want also to
print to a pdf file.

I did think that the following code should do the trick:

ppViewer.Report.ShowPrintDialog := True;
ppViewer.Report.AllowPrintToFile := True;
ppViewer.Report.DeviceType := 'PDFFile';
ppViewer.Report.TextFileName := '';
ppViewer.Report.Print;


But I get a preview screen popup! But when I don't use this code evreything
will be correctly printed on the printer. Am I forgetting something?

I'm using Delphi 5 with ReportBuilder 7.01 Enterprise.

Thanks in advance and best regards,


Mischa E.J. Hoogendoorn

Comments

  • edited April 2003
    Where is this code being called? When you call Report.Print, it should print
    to the device that you have selected in the Report.DeviceType property. Try
    calling Report.Print instead of Viewer.Report.Print.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited April 2003
    Hi Jim,

    I did give it a try, but it just doesn't work.

    I will descripe the situation for you:

    I have a mainform where all reports are presented in a viewer. This works.
    Now there are 2 buttons on the form. One to print, with the code:

    ppViewer.Print;

    This works just fine.

    Now I have a second procedure (buttonclick):

    procedure TfrmMain.sbtnPrintTofileClick(Sender: TObject);
    begin
    DmMain.ppReport.ShowPrintDialog := True;
    DmMain.ppReport.AllowPrintToFile := True;
    DmMain.ppReport.DeviceType := 'PDFFile';
    DmMain.ppReport.TextFileName := '';

    DmMain.ppReport.DeviceType := 'PDFFile';
    DmMain.ppReport.Print;
    end;

    This seems like you told me. The report I am referring to is connected with
    the viewer component. But when I run this, I will get a popup screen that is
    called: Print Preview. This is a standard screen and actually displaying
    what I see in my mainform on the viewer component.

    I have also tryed to delete the upper 4 lines in this procedure, but no
    difference is found.

    I'm out of options here. Do you have some idea's?

    Thanks in advance and best regards,


    Mischa E.J. Hoogendoorn












  • edited April 2003
    Perhaps the report that is connceted is not the one you are thinking that
    you are using? Is a template being loaded? Can you recreate this in a simple
    example and send it to us at support@digital-metaphors.com I'll be happy to
    take a look at in the debugger.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.