Sending fax with .NET

随声附和 提交于 2020-01-25 02:59:09

问题


I'm trying to send faxes with a .NET (C#) program using Crystal Reports and Unimessage Pro (or any other fax program).

My problem is that Unimessage Pro (and other fax programs) uses printer fonts for the fax commands. Since .NET doesn't support printer fonts the fax commands in the report are converted to Courier New. The result of this is that the fax program doesn't recognize the fax commands but sees them as plain text and the fax isn't sent.

How do I send a fax with Crystal Reports and .NET?


回答1:


I got this answer from WordCraft (company behind Unimessage Pro)

  1. Create a file named WilCapAX.INI in the main Windows folder, e.g. C:\Windows\WilCapAX.INI The file should contain the following: [WilCapAX] Commands=C:\Commands.DAT Where "C:\Commands.DAT" is the name of a text file you are going to create in your .NET application to pass the
    embedded commands to Unimessage Pro. You can edit the path if necessary, but keep to short form file and
    folder names.

  2. In your .NET application when you have something to send via
    Unimessage Pro you then need to:

    2.1 Create a text file named, depending on the name defined in WilCapAX.INI, C:\Commands.DAT containing:

     BLANK LINE
     [[TO=Fax Number or Email address]]
     [[SUBJECT=Whatever you want the subject to be]]
    

    The first line of the file must either be blank or contain something other than an embedded command - it will be skipped. The other lines in the C:\Commands.DAT file should each contain an embedded command.

    2.2 Print ONE message to the Unimessage Pro printer - the Unimessage Pro printer accept the print job and will look for the file specified in WilCapAX.INI. If the file specified in WilCapAX.INI (C:\Commands.DAT) is found, embedded commands are extracted from it and then the "C:\Commands.DAT" file is deleted and the print capture processed together with the command extracted from the C:\Commands.DAT file.

    2.3 Wait for the C:\Commands.DAT file to disappear (indicating that it has been processed by the Unimessage Pro printer) and then repeat as necessary.

This solved the problem! :)




回答2:


Joyfax Client Console 1.0 (beta)

Note: Please lanuch Joyfax Client v5.2 or above before runnig this application.

JoyfaxConsole [Options] -f [;...][;FileN] -r ""

-f  file or folder  Files or files in sub folders to be faxed.
        i.e: C:\Test\;C:\MyPDFs\*.pdf
-r      Recipients  Recipient list. For more see Fax Recipients. Must begin and end with double quotation marks(").

Options:

-a  Synchronous Wait until fax sent completed;
-s  Subject Subject of fax, i.e.: "Joyfax Sell Sheet";
-m  Meno Memo of fax, i.e.: "Joyfax Server 5-user license";
-c  CoverPage Cover Page profile to be used;
-d  Header Header & footer profile to be used,
    0 = None; 1 = General; 2 = Compact; 3 = Detailed
-k  Kill Delete input files if fax sent successfully.

Retrun:

0 - Success;
1 - Initialize failed;
2 - Invalid parameter;
3 - Unknown erorr (may unsupported file type).

Example:

JoyfaxClientConsole -d 2 -f "C:\My PDFs\D90.PDF" -r "Samm Kivin<866-6554-564>;Mr. Green<(846)6554-564>"

JoyfaxClientConsole -f C:\MyPDFs*.pdf;D:\Sell.xls -r "Samm Kivin<866-6554-564>"

JoyfaxClientConsole -s "Joyfax Sell Sheet" -m "Joyfax Server 5-user license" -f D:\Sell.xls -r "Kivin<866-6554-564>"




回答3:


When you say uses printer fonts, I'm assuming that you need to send some PCL (or similar) commands such as:

<esc>(s..... 

If that's the case I don't think you can embed that in that with Crystal directly.

We've had to send special sequences in the past through Crystal (without the Escape), in these cases we create a new Formula box and don't change any of the elements other then the font (choose Courier). These elements should pass right to the printer without being converted too much by the driver. This may; however, not solve your problem.

The other option that should work is to build your own printer driver with Microsoft's Driver Development Kit. You can create your own Mini Driver and associate a font with a specific font call so when you specify that font you get the code inserted into your code properly.

You could also process this in the manner that we do (not with Crystal but another similar reporting too). We use RightFax as our fax server and it allows for the 'attachment' of files through a metadata file. We generate the report, put it into a specific location as a PDF or other format and then pass RightFax an metadata file that contains the fax number of the recipient and a command that tells it to attach the file on the filesystem.

The RightFax 'attach' file looks something like this:

{{begin}}
{{nocover}}
{{fax (403) 555-1212}}
{{subject Test Fax}}
{{attach c:\reports\report1.pdf delete}}
{{imagetype pdf}}
{{end}}


来源:https://stackoverflow.com/questions/545173/sending-fax-with-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!