Faxing PDF doc via SBS Shared Fax Service and an ASP.NET page

D

Dan Williams

I am trying in vain to programmatically send a PDF document using the
SBS Shared Fax Service and an ASP.NET web page.

I have managed to use the following VB.NET code to send a Word
document via my own XP development PC using its fax service, but it
doesn't appear to work on our SBS 2000 server.

Sub SendFax()
Dim fxsvr As New FAXCOMLib.FaxServerClass
Dim fxdoc As FAXCOMLib.FaxDoc
Dim strFileName as String = "C:\test.pdf"

Try
fxsvr.Connect("")
fxdoc = CType(fxsvr.CreateDocument(strFileName),
FAXCOMLib.FaxDoc)
fxdoc.FaxNumber = "01234 567890"
fxdoc.Send()
fxsvr.Disconnect()
Catch ex As Exception
Response.Write("<B>" + ex.ToString() + "</b><BR>")
End Try
End Sub

I've read the Microsoft Q301109 article about using an
Outlook.Application object with the SBS Shared Fax Service, but there
are issues with permissions as the ASP.NET account doesn't have access
to an Outlook profile.

I've attempted to impersonate a valid domain user using the Microsoft
Q248187 article, but this complains with an error when calling the
LogonUser function:-

System.NullReferenceException: Object reference not set to an instance
of an object.

Aren't there also issues with impersonating a different user with
ASP.NET and Windows/SBS 2000? Also, if using Outlook is my only option
with SBS, i doubt i'm going to be able to make the email body the same
as our PDF contents!!

Anybody got any bright ideas as i seem to be going around in circles
with this?

Would it be an option to uninstall the SBS Shared Fax Service and just
have the standard Microsoft Fax Service (as i have on my XP
development machine)? I've also struggled to get the standard Fax
Service to send PDF faxes from ASP.NET, but it does work if i simply
print to the fax printer from Acrobat Reader!!

Is there any third-party software i can try in order to send PDF files
via our Intranet application?

Just out of interest, our PDF files are dynamically created by Crystal
Reports and need to be faxed to clients fax numbers from our SQL
database. Ideally, they have to be PDF files as the forms get faxed
back by our clients and scanned by our OCR software with the results
automatically imported to our SQL database. That way the PDF forms
remain the same size and format without the fear of user intervention
with margins and page setup, etc. and hence our OCR software can
recognise the returned forms.

Any help is much appreciated.

Thanks in advance.

Dan Williams.
 
F

Fred Blum

I've have never tried this, but it looks like you're trying to send it
directly to the faxserver. Isn't it easier to send (print) it to the locally
installed printer Shared Fax?

Fred
 
R

Raghavendra R [MSFT]

Fax APIs are not officially supported on SBS 2000 server. You can observe
that Fax API documentation never makes a mention of SBS. Hence my sincere
advise to you would be to upgrade your server to Windows Server 2003 & use
Fax Extended COM APIs
(http://msdn.microsoft.com/library/en-us/fax/faxabout_699l.asp) instead of
Legacy Fax COM APIs. Before doing that make sure your ASP.NET application
can work well on a Windows Server 2003 box (or if not, on a Windows XP box).
If you face any problems here, please let us know in more detail.

On a side note take a look at
http://support.microsoft.com/default.aspx?scid=kb;en-us;303647 - it explains
how to send a fax from an ASP page on Windows 2000. It might be of some help
to you.
--
Raghavendra R
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.'
 
D

Dan Williams

OK, thanks for the advice.

We do have another Windows 2000 Server that i'm now currently
attempting this on, but i'm experiencing the following error:-

System.Runtime.InteropServices.COMException (0x80004005): Unspecified
error at FAXCOMLib.FaxServerClass.Connect(String ServerName) at
bookings.staffAppraisal1.ASPNETSendFax()

I've even tried installing the Platform SDK on the server to see if
it'd help, but no joy.

I've seen that Q303647 article before and have even converted it to
ASP.NET and attempted the following:-

Sub SendFax()
Dim FXWrap As New FaxComWrapper.FaxSend
faxNo = "01803 867218"
FXWrap.SendFax(strFileName, faxNo)
FXWrap = Nothing
End Sub

This comes back with a similar error to my first one, which sort of
suggests somethings wrong with my Fax Service.

System.Runtime.InteropServices.COMException: Unspecified error


Is it possible to download the latest Fax Service for Windows 2000 as
there are slight differences between the 2k one and XP. The XP one,
for example, has a Fax Console interface showing incoming, inbox,
outbox and sent items folders, where as the 2000 fax service simply
has a fax queue option, similar to a print queue.

Any other bright ideas? I have seen an alternative at
http://www.protonet.com/efax/asp_fax.htm but i'm awaiting the email
from them so that i can download their fax service.

Thanks again

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top