- I
am sure I entered the correct COM port name but I get a "port
not found" error
- I
get fax transmission errors (timeouts ...) and the fax cannot be sent/received
- Can
I send several faxes at the same time?
- How
can I fax HTML code containing images?
- Faxing
HTML: which HTML features are supported?
- Faxing
HTML: how can I fax several HTML pages?
- How
can I fax PDF files?
- How
can I fax color or grey-scale images?
- The
fax I send looks distorted
- The
images I fax are received a black boxes.
- Can
I use a modem in a remote machine for sending the faxes?
- Can
I send faxes through the internet?
- Can
I fax Word or MS Office documents?
|
1. I am sure I entered the correct COM port name but I get a "port
not found" error. |
This is normally
due to a wrong configuration of the commAPI.
Put the javax.comm.properties file in the /lib directory and put
the win32com.dll in the /bin directory. You might also need to put
the javax.comm.properties file in the /jre/lib directory and the
win32com.dll in the /jre/bin directory.
If you have several
Java VM installed on you computer make sure you install the commAPI in
the correct one.
|
2. I get transmission errors (timeouts ...) and the fax cannot be sent/received |
This is normally
due to a wrong configuration of the flow control. Make sure:
- You select modem
class=1
- You select hardware
flow control (RTS/CTS)
- You enter the
correct flow control command for RTS/CTS. For most modems it is AT&K3.
US Robotics normally require: AT&F1&H1&R2&B1. Please check your modem's
manual.
|
3. Can I send several faxes at the same time? |
If your computer
has several ports and modems you can create several java threads and several
instances of the FaxModem class. Rfax uses temporary files called faxtmp.0
(first page), faxtmp.1 (second page) .... so you need to make sure each
FaxModem instance uses a different name for the temporary files. This
can be done with the following property:
/** * temporary fax file. The extension 1,2,3... will be added for the
different pages */
public String faxFile="tmpFax";
so one FaxModem
instance can use
faxModem1.faxFile="tmpPort1Fax";
and the other one
faxModem2.faxFile="tmpPort2Fax";
|
4. How can I fax HTML code containing images? |
The following example
shows you how to have images in the html code to be faxed:
<html>
<head> <title>FAX Example</title> </head>
<body>
<img src="file:///c:/images/datamatrix.gif">
</body>
</html>
|
5. Which HTML features are supported? |
The HTMLFaxProducer
uses the Swing JEditorPane component for rendering the html code.
Therefore you can fax any html code which can be rendered by the JEditorPane
component.
|
6. How can I fax several HTML pages? |
The HTMLFaxProducer
cannot split a long html code into several fax pages. For this reason
you must split the html code yourself and provide each fax page as a separate
HTML page. For example:
p= new HtmlFaxProducer();
String[] htmlPages=new String[1];
htmlPages[0]="<html><body>This is my first page</body></html>";
htmlPages[1]="<html><body>This is my second page</body></html>";
p.text=htmlPages;
|
7. How can I fax PDF files? |
in order to fax pdf
files you need a pdf fax producer. You can download the AcrobatFaxProducer.java
here.
It uses the java
bean from Acrobat for the rendering process. You must download the java
bean from:
http://www.adobe.com/products/acrviewer/acrvdnld.html?name=Accept#java
Select "Acrobat reader
for java bean" at the bottom of the page.
You can test the
producer like this:
try {
AcrobatFaxProducer pdf=new AcrobatFaxProducer();
pdf.setPDFFile("c:\\report.pdf");
FaxModem fm= new FaxModem();
pdf.pageImage=new BufferedImage(800,1290,java.awt.image.BufferedImage.TYPE_INT_RGB);
FaxModem m=new FaxModem();
m.setPortName("COM1");
m.flowControl=m.FLOWCONTROL_XONXOFF;
m.faxClass=2;
m.AtFBOR=true;
m.open(p);
if (m.sendFax("11111111")) System.out.println("Success
***");
else System.out.println("FAILED");
m.close();
}
catch ( Exception e ) { e.printStackTrace();}
|
8. How can I fax color or grey-scale images? |
You can't. Faxes
are made of black and white pixels only. There is no way to send color
or grey pixels in the fax protocol.
|
9. The fax I send looks distorted |
Probably you are using
too small image.Faxes have 2 resolutions:
- NORMAL: about
1700*1150 dots.
- FINE: about 1700
* 2300 dots.
Therefore you can
use one of the following configurations:
- use an image
850*1150, encoder.scalefactor=1 and resolution=NORMAL
- use an image
850*1150, encoder.scalefactor=2 and resolution=FINE
- use an image
1700*2300, encoder.scalefactor=1 and resolution=FINE
We recommend you
to use the FINE resolution and pass the correct image size to the fax
producer. For example:
p= new HtmlFaxProducer();
p.pageImage=new BufferedImage(1700,2300,java.awt.image.BufferedImage.TYPE_INT_RGB);
...
m=new FaxModem();
// scale and center image
m.getEncoder().scaleFactor=1;
...
|
10. The images I fax are received a black boxes |
Faxes are black and
white images only so Rfax will convert all non white pixels to black.
If you, for example, try to fax an image with yellow background it will
be converted to a black box. If you can, we recommend you to create black
and white images for faxing. Note that grey scales are not black and white.
RFax has a property
called whiteTreshhold which lets you control how the color to black/white
conversion is performed. Color pixels are converted to RGB values and
the following code is used to decide if the color is converted to white
or to black:
if ((255-red) <
whiteTreshhold) whiteW++;
if ((255-green) < whiteTreshhold) whiteW++;
if ((255-blue) < whiteTreshhold) whiteW++;
boolean isWhite=(whiteW==3);
The default whiteTreshhold
value is 100. It can be changed with faxModem.getEncoder().whiteTreshhold=XXX;
|
11. Can I use a modem ina remote machine for sending the faxes? |
RFax requires a local
fax modem and a telephone line, see: http://www.java4less.com/java_fax.htm
|
12. Can I send faxes through the internet? |
We may develop the
fax internet protocol in the future, but at this time rfax uses a analog
telephone line just like conventional fax machines.
|
13. Can I fax Word or MS Office documents? |
We do not have any
FaxProducer to do so. FaxProducer are in charge of converting a document
(html, pdf, Word ...) to an image (for example java image, gif or jpg).
If you have or can find a way to convert a Word document to an image then
it is very easy to create a fax producer to fax such image.
|