Atom Feed RSS Feed

Il mio profilo

My Photo
Name: blog
Location:

Send Fax from ASP.NET

postato da blog.cyberman.it [19/07/2010 09:38]

I use this code snippet to send a fax via ASP.NET page:

 

private void SendFax(string faxNumber, string fileName)

        {

            try

            {

                FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();

 

                faxServer.Connect(Environment.MachineName);

 

                var faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(fileName);

                faxDoc.FaxNumber = "0" + faxNumber;

                faxDoc.RecipientName = "Dest " + faxDoc.FaxNumber;

                faxDoc.DisplayName = faxDoc.RecipientName;

                faxDoc.Send();

    faxServer.Disconnect();

 

                MessageBox.Show("OK");

            }

            catch (Exception exception)

            {

                MessageBox.Show(exception.Message);

            }

        }

 

But i get this error:

The data is invalid Exception from HRESULT: x8007000D

 

The problem is that there is no file association (for the "print" command) on the server for the extension of the file that I need to FAX out.

Try create Shell association for "print" command or reinstall the viewer (ex. Acrobat Reader).

To verifythat the extension has the corret"print" command right-click on a file with this extension and verify that is present a menu item "Print".