FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Faxinng from FWH
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Faxinng from FWH
Posted: Tue Mar 07, 2017 04:07 PM

If it possible to fax a PDF file from within FWH ?

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 04:22 PM
Jeff,

I use this code to print a PDF from my application :
Code (fw): Select all Collapse
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 04: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)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 04:42 PM
Try these two samples. Honestly I don't know if they still work in the current Windows versions.

Code (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 05: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)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 05:59 PM
This seems to work:

Code (fw): Select all Collapse
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 (fw): Select all Collapse
oDoc:Recipients[ 1 ]:Name = "Enrico Maria Giordano"


EMG
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Tue Mar 07, 2017 08: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)
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Faxinng from FWH
Posted: 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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 10:07 AM

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

EMG

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 01: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)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 01:14 PM

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

EMG

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 01: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)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 05: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)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Faxinng from FWH
Posted: Wed Mar 08, 2017 05:51 PM

Great! Thank you for the feedback.

EMG

Continue the discussion