Faxinng from FWH

Faxinng from FWH

Postby Jeff Barnes » Tue Mar 07, 2017 4:07 pm

If it possible to fax a PDF file from within FWH ?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby driessen » Tue Mar 07, 2017 4:22 pm

Jeff,

I use this code to print a PDF from my application :
Code: Select all  Expand view
WAITRUN("SumatraPDF.exe -Print-to-default -exit-on-print " + dNameDoc,1)
dNameDoc is my PDF-file I want to print.

You can download SumatraPDF.exe from http://www.sumatrapdfreader.org.

It is the portable version I use.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Faxinng from FWH

Postby Jeff Barnes » Tue Mar 07, 2017 4:27 pm

Thanks Michel, but I'm looking for something that will Fax without any user intervention.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby Enrico Maria Giordano » Tue Mar 07, 2017 4:42 pm

Try these two samples. Honestly I don't know if they still work in the current Windows versions.

Code: Select all  Expand view
FUNCTION MAIN( cTel )

    LOCAL oFax := CREATEOBJECT( "FaxComEx.FaxServer" )

    LOCAL oDoc := CREATEOBJECT( "FaxComEx.FaxDocument" )

    IF EMPTY( cTel ); cTel = "0639728261"; ENDIF

    oFax:Connect( "" )

    oDoc:Body = CURDRIVE() + ":\" + CURDIR() + "\TEST.DOC"

    oDoc:DocumentName = "
Fax test"

    oDoc:Recipients:Add( cTel )

    oDoc:Recipients( 0 ):Name = "
Enrico Maria Giordano"

    oDoc:ConnectedSubmit( oFax )

    oFax:Disconnect()

    RETURN NIL


Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL oFax := CREATEOBJECT( "FaxServer.FaxServer" )

    LOCAL oDoc

    oFax:Connect( "COM1" )

    oDoc = oFax:CreateDocument( "E:\XHARBOUR\FAX.TXT" )

    oDoc:FaxNumber = "0639728261"

    oDoc:FileName = "E:\XHARBOUR\FAX.TXT"

    oDoc:Send()

    oDoc:Disconnect()

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Faxinng from FWH

Postby Jeff Barnes » Tue Mar 07, 2017 5:06 pm

Sadly no, with either example I get a "member not found" error.
I do have the window fax service enabled. Is there anything else I need to have for this to work?

First example give the error for:
oDoc:Recipients:Add( cTel )
oDoc:Recipients( 0 ):Name = "Enrico Maria Giordano"

Second example gives error for:
oFax:Connect( "COM1" )
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby Enrico Maria Giordano » Tue Mar 07, 2017 5:59 pm

This seems to work:

Code: Select all  Expand view
FUNCTION MAIN( cTel )

    LOCAL oFax := CREATEOBJECT( "FaxComEx.FaxServer" )

    LOCAL oDoc := CREATEOBJECT( "FaxComEx.FaxDocument" )

    IF EMPTY( cTel ); cTel = "0639728261"; ENDIF

    oFax:Connect( "" )

    oDoc:Body = CURDRIVE() + ":\" + CURDIR() + "\TEST.DOC"

    oDoc:DocumentName = "
Fax test"

    oDoc:Recipients:Add( cTel )

    oDoc:Recipients[ 1 ]:Name = "
Enrico Maria Giordano"

    oDoc:ConnectedSubmit( oFax )

    oFax:Disconnect()

    RETURN NIL


Please note the difference here:

Code: Select all  Expand view
oDoc:Recipients[ 1 ]:Name = "Enrico Maria Giordano"


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Faxinng from FWH

Postby Jeff Barnes » Tue Mar 07, 2017 8:26 pm

Thanks Enrico. Looks like it might work ... suffering some modem issues but your code will connect, dial and try to send. I might need a new modem with updated drivers :(
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby driessen » Wed Mar 08, 2017 10:01 am

Enrico,

What do you do if your fax is the same as your networkprinter?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Faxinng from FWH

Postby Enrico Maria Giordano » Wed Mar 08, 2017 10:07 am

It shoudn't make any difference. What do you get? Any error message?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Faxinng from FWH

Postby Jeff Barnes » Wed Mar 08, 2017 1:10 pm

I get this error: "The fax can't be sent because of an unexpected error"
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby Enrico Maria Giordano » Wed Mar 08, 2017 1:14 pm

Try to send the fax manually and check if you get this error either.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Faxinng from FWH

Postby Jeff Barnes » Wed Mar 08, 2017 1:27 pm

Sending manually gives me the same error :(

Must be something with the Windows Fax software.
The first fax modem I tried was an external usb type.
Then I tried with an internal fax modem.
Both do the exact same thing.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby Jeff Barnes » Wed Mar 08, 2017 5:47 pm

Problem solved....

I went into Add/Remove Program Features and removed windows fax/scan. Rebooted. Added it back then rebooted again.
Now it works perfectly :)
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Faxinng from FWH

Postby Enrico Maria Giordano » Wed Mar 08, 2017 5:51 pm

Great! Thank you for the feedback.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 70 guests