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

How sending Fax number when printing to Microsoft XP Fax ?

edited April 2009 in Devices
Hey,

How can i send the fax number when i print to the Microsoft XP Fax :
"Microsoft Shared Fax Driver"
????

Thanks, Julien

Comments

  • edited April 2009
    Hi Julien,

    Try using the Advanced options button on the Print Dialog to access the
    features of the specific driver you are using. You can also access these
    options from the designer using the DeviceSettings property of the
    PrinterSetup.

    --
    Regards,

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

    Best Regards,

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


    You could print the report to a PDF file and then use OLE automation to
    communicate with the fax driver. See the "FaxServer" chapter in the Windows
    Platform SDK.
    Something like this might get you started:

    // Fax Services Windows 2000, XP, Server 2003 + folgende
    procedure TRptDataModule.SendWindowsFaxServices(const pmcFaxNumber,
    pmcPrinterName : String);
    var
    tempFileName : String;
    ssd : Boolean;
    faxServer : OleVariant;
    faxDocument : OleVariant;
    begin
    if pmcFaxNumber <> '' then begin
    with Report do begin
    tempFileName := GetTempPath + PrinterSetup.DocumentName + '.pdf';

    DeviceType := 'PDFFile'; // Waler's TExtraDevices, RB PDF
    device should have another name.
    TextFileName := tempFileName;
    ShowPrintDialog := False;

    // AutoSearchDialog has already been shown (we need to get the fax
    number from the selection)
    ssd := ShowAutoSearchDialog;
    ShowAutoSearchDialog := False;
    end;

    try
    Report.Print;

    faxServer := CreateOleObject('FaxServer.FaxServer');

    // Connect to the fax server.
    faxServer.Connect(GetComputerName);

    faxDocument := faxServer.CreateDocument(tempFileName);
    faxDocument.DisplayName := Report.PrinterSetup.DocumentName;
    // faxDocument.RecipientName := 'sth';
    faxDocument.FaxNumber := pmcFaxNumber;

    // Submit the document to the connected fax server.
    faxDocument.Send;

    faxServer.Disconnect;
    finally
    DeleteFile(tempFileName);

    Report.ShowAutoSearchDialog := ssd;
    end;
    end
    else begin
    // If there is no fax number, use the standard print functionality.
    with Report do begin
    // AutoSearchDialog has already been shown (we need to get the fax
    number from the selection)
    ssd := ShowAutoSearchDialog;
    ShowAutoSearchDialog := False;

    ShowPrintDialog := False;
    PrinterSetup.PrinterName := pmcPrinterName;
    DeviceType := 'Printer';

    Print;

    ShowAutoSearchDialog := ssd;

    ShowPrintDialog := True;
    end; // with Report
    end;
    end;

    Daniel
This discussion has been closed.