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

PDF Printing without a dialog box

edited September 2007 in General
Hello,

I use Delphi 5 Enterprise.

I Use following Report Builder Version 6.02 Enterprise version.

I need have a report to be sent to .PDF file format with out a dialog.
When i press a button in Delphi form, it should save to the .PDF file name
in a location i specify. Let me know it is possible ?.

I can export and save to .PDF file using print dialog after preview the
report builder preview, but i need as above mentioned.

Thanks and regards,
Vasan.



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

Comments

  • edited September 2007
    Hi Vasan,

    You need to set the Report.ShowPrintDialog property to False.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Nico,

    Thanks for the reply. It helps partly. But still i am facing problem.

    Let me tell my requirement..

    I just need to send a report to a .pdf file in a specified folder.

    After i changed Report.ShowPrintDialog = False it was still showing
    printer dialog, but when i said PrinttoDevices it did not show.

    I am doing the following.

    DeviceType := 'PDFFILE';
    AllowPrinttoFile := True;
    ModalPreview := False;
    ModalCancelDialog := False;
    PassSetting := psOnePass;
    ShowCancelDialog := False;
    ShowPrintDialog := False;
    ArchiveFileName := 'C:\Pdffile1.paf';
    PrintToDevices;

    When i called Print Method, it shows printer dialog.

    When i called Printtodevices method i don't get a printer dialog.

    I DONT GET THE PDFFILE NAME IN THE FOLDER .


    I need to also know about what is AllowPrinttoArchive, property and
    ArchiveFile name properties.

    Can you please give me all the properties i need to set and the method i
    have to call to send to .pdf file name in a folder. When i check the
    document you gave us with the version, it does not have an example to
    print to a PDF file (But it has to .txt file), also your website does not
    have a example to print to .PDF file with out showing printer dialog. Can
    you please document a sample code to print as a .pdf file from report
    builder report with out a dialog, and post it in FAQ will be most useful
    when people like me looking for help.

    Thanks for your kind help.

    Best regards,
    Vasan.




    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2007
    You need to use TextFileName, not ArchiveFileName.

    Edward Dressel
    Team DM


  • edited September 2007
    Hi Edward,

    Thanks. Now it works.

    The code is now very simple....

    ppReport1.DeviceType := 'PDFfile';
    ppReport1.AllowPrinttoFile := True;
    ppReport1.ShowPrintDialog := False;
    ppReport1.TextFileName := 'c:\Pdffile1.pdf';
    ppReport1.Print;
    The above code does not show dialog, it just sends report to the
    Pdffile1.pdf file.

    I hope Report Builder Team will document this sample code in the future
    documentation.

    Best regards,
    Vasan




    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2007
    Vasan,

    There is a code snip almost identical to your code below located in the
    TppPDFDevice help topic of the ReportBuilder help :).

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Niko,

    Probably available in later versions.

    Not available in ver 6.02 used for Delphi 5, either in documentation, or
    in .hlp and in the units.

    Best regards,
    Vasan.




    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2007
    The built-in PDF device was not introduced until RB 9. You are using a
    third party PDF device such as ExtraDevices or Gnostice.

    --
    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.