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

How to print to another printer

edited July 2008 in General
I have 2 printers, p1 and p2. P1 is the default. In code I want to print to
p2 (which is actually pdf995) to create a pdf file.

This is happening in the report previewer. I added a button in the toolbar
to send email. I want this button to set printer to PDF995, print to a file
I designate in code, then reset printer to whatever it was before email
button was pressed.

I'm using Version 7.04 of RB with D6.

procedure ExportPDFFile;
var
engIdx : integer;
begin
engIdx := self.Report.PrinterSetup.PrinterNames.IndexOf ('PDF995');

if (engIdx >= 0) then
begin
self.Report.PrinterSetup.PrinterName := 'PDF995';
// self.Report.PrinterSetup.FileName := EmailFileName;

self.Print;

SimpleMapiMail.Attachments.Add (EmailFileName);
end;
end;

Problems:
1 - The print statement causes print dialog to pop up. How do I suppress
that?
2 - How do I tell the PDF995 print driver the name of file to create?

Help is much appreciated.

Keith

Comments

  • edited July 2008
    Same problems as before, but here is latest code and notes...

    procedure ExportPDFFile;
    var
    engIdx : integer;
    savePtr : string;
    begin
    engIdx := self.Report.PrinterSetup.PrinterNames.IndexOf
    (DBConfig.PDFEngine);

    // 7/9/08 - If user has their own pdf report engine (saved in
    DBConfig.PDFEngine)
    // use their engine to generate the pdf file
    if (DBConfig.UsingPDFEngine = 'Y') and (engIdx >= 0) then
    begin
    savePtr := self.Report.PrinterSetup.PrinterName;

    try
    self.Report.PrinterSetup.PrinterName := DBConfig.PDFEngine;

    // self.Report.PrinterSetup.FileName := EmailFileName;

    self.Print;
    SimpleMapiMail.Attachments.Add (EmailFileName);
    finally
    self.Report.PrinterSetup.PrinterName := savePtr;
    end;
    end

    Problems:
    1 - The print statement causes print dialog to pop up. How do I suppress
    that?
    2 - How do I tell the PDF995 print driver the name of file to create?
    3 - The call to self.print triggers the creation of the pdf file, but my
    program resumes running before the pdf is created, so the attachments.add
    statement does not work as expected.

    Thanks in advance,

    Keith

  • edited July 2008
    The makers of PDF995 have been helpful with this... I think I just need one
    more question answered... how do I print report from TppPreview and suppress
    the printer select window?

  • edited July 2008

    RB 10 has built-in Email support and built-in support for PDF. The preview
    toolbar contains an Email button. The user can press the button and
    automatically the PDF attachment is created and their email client is
    displayed.

    RB 10 can open reports created by prior releases, including RB 7.x.

    RB includes support for D6, D7, D2005, D2006, D2007.

    Please consider updating to RB 10.

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2008
    > Is there a way to print w/o getting the select printer dialog?

    TppReport.ShowPrintDialog := False;


    I've seldom had a problem with Report Builder--maybe version 6? Moving from
    the beta to the release.... FWIW, I don't use DADE in RB, but do push some
    of the other limits.


    Just recompile the packages, if you use the at design time. I don't, I just
    put the units in my uses clause.


    but AFAICK it requires your customers to purchase it--not always an option.
    I've found that anytime I've sent an issue in on the PDF driver, it's
    normally been fixed very quickly.


    send an email directly to sales@.. for that

    HTH
    Ed Dressel
    Team DM
  • edited July 2008
    Is there a way to print w/o getting the select printer dialog?

    I am leary about upgrading as it always seems to introduce new problems.

    Problem I'm having right now is with Pragnaan and PDF output... If I upgrade
    I suppose I won't need Pragnaan anymore, correct?

    Also, what do you say about criticisms about RB's PDF quality, file size or
    speed? PDF995 is fast and creates very small files, and renders well.

    If I upgrade and have problems what is return policy?

    Thanks.

    Keith

  • edited July 2008

    RB 10 is far superior to RB 7 - no camparison there - better architecture,
    better features, better stability/quality. I recommend downloading a trial
    version. We offer a 30-day money back guarantee on purchases.

    Using a printer driver PDF solution is not desirable to most of customers
    due to the deployment issues and the lack of control. RB 10 can work with
    Gnostice, Pragnaan, ExtraDevices. You can do some testing with these
    solutions to determine what works best for your needs. I think for PDF,
    Gnostice has the most advance support.

    The RB Email feature can work with any of the device add-ons mentioned
    above - PDF and other formats as well. The RB Email feature supports
    plug-ins - and includes plugins for MAPI, Indy9, Indy10, and Synapse. So all
    in all you have ultimate flexibility in configuration.



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2008
    My code is in the descendent object of a TppPreview. It is basically:

    self.Report.ShowPrintDialog := false;
    self.Print;

    I still see the dialog box asking me to choose the printer. What am I doing
    wrong?

  • edited July 2008
    you need to interrupt the button print and do your own.

    I cannot remember how it was done it v. 7--look at the source--I think you
    assign a method to the button's click, but you should be able to find it.

    Ed Dressel
This discussion has been closed.