Java Fax API - Send Faxes with a Few Lines of Code

Need a Java fax API? The InterFAX Java API lets you send faxes using only a few lines of code, with no installations. InterFAX accepts documents in all popular formats, including MS Word, PDF, ASCII, HTML, URL, and others - and sends them to a fax number you specify. The service offers basic fax send/receive, and advanced features such as multiple destinations, deferred transmission, document resolution, and more.


Sign up now for our free developer program and receive immediate access to the InterFAX Fax API, including Java fax API functionality. No hardware installations, no software setup, no phone lines to order.

Java Fax API Code Samples

Title Body
Java Fax Tutorial

This step-by-step guide demonstrates how to send a Java fax using the InterFAX XML Web service.

Java Fax Tutorial - Building a Web Service Client

In this tutorial, you learn how to write a Java fax program that uses the InterFAX web service. In the tutorial distribution, you can find a fully-working copy of the demo program you're about to build.

This section covers determining your Java version, creating a new project directory, adding the InterFax Java client library and other dependencies to your classpath, and registering for an InterFAX developer account.

Java Fax Tutorial - Sending a Fax

This section demonstrates how to send a Java fax: creating a fax script, testing the fax script, viewing the fax status and going live with your script.

If you haven't built your web service client or signed up for an InterFAX developer account, refer to the Building a Web Service Client section.

Web Services Primer

The Wikipedia entry for web service ( is a good place to start learning about web services and the family of standards and technologies that make them happen. In a nutshell, a web service is a program made available by its author to other programs on a computer network. Web services usually do useful things--today there are web services that provide real-time stock quotes, translate text to braille, perform complex statistical analyses, and all sorts of other things.

Java Fax - Send Plain-Text File with SendCharFax

In this Java fax code sample, you learn how to send a plain-text fax using the SendCharFax method. When sending a fax using SendCharFax, make sure your text is standard ASCII (no 8-bit characters), however note that it can include HTML markup (Using HTML causes automatic word wrapping, whereas regular text does not).

Java Fax - Submit a Binary File Using SendFax

This code sample demonstrates how to submit a Java fax with one attachment (binary file) to the InterFAX Web service, using the method SendFax.

Java Fax - Get Information about a Submitted Fax with FaxStatusEx

This code sample retrieves information about one or more submitted Java faxes, using the method FaxStatusEx.

Java Fax - Send Faxes to Multiple Recipients Using SendfaxEx_2

Sending a Java fax to one or more recipients with one or more attached files is done using the SendfaxEx_2 method. This method has more flexible sending capabilities than Sendfax (see Side-by-side Comparison of Web Service Methods for more details).

Java Fax - Get Detailed Information About Outbound Faxes

This section demonstrates the FaxQuery method, which provides more advanced querying capabilities than the FaxStatusEx method (for more details, see Side-by-side Comparison of Web Service Methods). This Java Fax code sample can also be found in the ZIP file above (see the green 'Download' box), under the path interfaxJavaSamples > src > GetStatusWithFaxQuery.

Java Fax - Query Outbound Faxes with FaxQuery2

In this section, you use the FaxQuery2 method to retrieve detailed information about one or more submitted Java faxes. You can locate this code sample in the ZIP file above (see the green 'Download' box), under the path interfaxJavaSamples > src > GetStatusWithFaxQuery2.

Java Fax - Retrieve a List of Inbound Faxes Using GetList

This Java fax sample demonstrates the GetList method, which allows you to retrieve a list of inbound (received) faxes.

Java Fax - Retrieve the Image of a Received Fax

In this section, GetImageChunk is used to retrieve an image for an inbound (received) Java fax. To retrieve the fax image, you need to first use the GetList method to get the fax message ID and file size.

Java Fax - Fetch the Image of a Submitted Fax

The GetFaxImage method, demonstrated in the following Java fax API snippet, retrieves the image of a previously-submitted, outbound fax.

Java Fax - Cancel a Pending Fax

This sample allows you to cancel a Java fax that was previously submitted to the InterFAX Web service. This can be done using the CancelFax method. CancelFax only effects faxes waiting to be sent (with the status codes: -1 Preprocessing, -2 Ready, or -3 Pending Retry), and not faxes that actively-transmitted Java faxes.

Get Started
Sign up now for our free developer program

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today