Hello,
my problem:
i can't send any PDFs. I get the message:
"550 c:\neu\test.jpg: No such file or directory."
my code:
import gnu.hylafax.Client;
import gnu.hylafax.HylaFAXClient;
import gnu.hylafax.Job;
import gnu.inet.ftp.FtpClientProtocol;
import java.io.File;
import java.util.Vector;
public class neu {
/**
* @param args
*/
public static void main(String[] args) {
Client c = new HylaFAXClient();
try {
//Open the host.
c.open("************");
c.user("*************");
//Set the transfer mode and type. This is important if you are
//having problems getting the HylaFAX server recognize the files
//you are sending.
c.mode(FtpClientProtocol.MODE_STREAM);
c.type(FtpClientProtocol.TYPE_IMAGE);
//Do this only is a password is required in the hosts.hfaxd
//file on the server.
c.pass("*****");
//Do this if you want to do admin functions. Must be configured
//correctly in the hosts.hfaxd file.
//c.admin(password);
//Create a new job.
Job job = c.createJob();
//Set the job properties. This can be any jparm property specified
//in the hfaxd manual page. If there is not a native function for
//the property you are trying to set, use the setProperty function
//to set it.
job.setFromUser("hagen Köckritz");
job.setNotifyAddress("hagen.koeckritz@revolutive-systems.com");
// job.setKilltime("");
job.setMaximumDials(5);
job.setMaximumTries(5);
job.setPriority(job.PRIORITY_NORMAL);
job.setDialstring("0094027882169");
job.setVerticalResolution(job.RESOLUTION_MEDIUM);
// job.setPageDimension(job.p);
job.setNotifyType(job.NOTIFY_ALL);
// job.setChopThreshold(job.CHOP_DEFAULT);
//Add any documents to send. As long as the HylaFAX server is setup
//properly you should be able to send PS, PDF, and TIFF documents.
//The HylaFAX server always converts them to PS before sending them.
Vector<String> documents = new Vector<String>();
documents.add("c:\\neu\\test.jpg");
File f = new File("c:\\neu\\test.jpg");
System.out.println(f.exists());
for (int i = 0; i < documents.size(); i++) {
String document = (String) documents.elementAt(i);
job.addDocument(document);
}
//Submit the job to the scheduler.
c.submit(job);
} catch (Exception e) {
e.printStackTrace();
} finally {
//Close the client.
try {
c.quit();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
whats wrong? Can anyone help me?
documents.add("c:\\neu\\test.jpg"); assums the test.jpg is on the server with a path relative to the hylafax installation directory. You need to call String documentPath = client.putTemporary(documentInputStream); then documents.add(documentPath);
Also be aware that hylafax won't send jpgs directly. You will need to convert it to a pdf or tiff prior to sending.