A Ghostscript alternative you can ship in closed-source Java software

Convert PostScript, EPS and XPS to PDF and images from a pure Java library with no JNI, native converter binary or copyleft obligations.

 

You need to convert PostScript, EPS or XPS files inside your Java application. The Artifex tools do this well and cost nothing to download: Ghostscript interprets PostScript and EPS, and GhostXPS covers XPS. Then your legal team reads the licence and the project stops.

Even where licensing is settled, your operations team may ask why every host and container now needs a native library that matches its architecture and C runtime.

This page explains both constraints, the options — including the ones that do not involve us — and how to migrate if Aspose.Page is the right fit.

What the licence actually requires

Ghostscript has been dual-licensed under the GNU Affero General Public License v3 since version 9.07 in February 2013. Before that it was GPL v3. Artifex Software owns the copyright and sells a commercial licence as the alternative to AGPL compliance. The same dual licensing covers the wider GhostPDL source tree, which includes the GhostXPS interpreter, so handling XPS instead of PostScript does not change the licensing question.

The AGPL's copyleft provision can require the complete corresponding source code of a derivative work to be released under the AGPL. It also extends to software offered to users over a network, so a Java web application or SaaS backend that never ships a JAR is not automatically outside its scope.

The nuance that matters: linking versus shelling out

A common position is that invoking `gs` through `ProcessBuilder` avoids copyleft because the application is not linked to the library. This is genuinely contested territory. Guidance differs on whether a process boundary is decisive or whether the intimacy of the communication and design of the combined program matter more.

The common Java wrapper `ghost4j` is different again: it binds the Ghostscript C API through JNA and loads the native library into the JVM process rather than shelling out.

We are not your lawyers, and this page is not legal advice. Your legal team must assess how your product is built, offered and distributed. For many teams, the uncertainty itself is a cost they are unwilling to carry.

Case law

In *Artifex Software, Inc. v. Hancom, Inc.*, Artifex alleged that Hancom had incorporated GPL-licensed Ghostscript into Hancom Office without buying a commercial licence or complying with the GPL's source-disclosure requirements.

On 25 April 2017, the U.S. District Court for the Northern District of California denied Hancom's motion to dismiss. The ruling allowed Artifex to proceed on both breach of contract and copyright infringement. The parties settled in December 2017.

The significance is narrow: an open source licence is enforceable. The ruling does not decide that every integration or separate-process invocation creates a derivative work.

Your options

There are three honest routes, and only one of them involves us.

1. Buy a commercial licence from Artifex

Artifex sells a commercial licence so companies can use Ghostscript in closed-source products. This is a legitimate, supported route and is likely the right choice when you depend on Ghostscript's full capability set. It resolves the licensing question, though the native dependency remains.

Choose this if: you use Ghostscript as a full PostScript or PDF interpreter or RIP, including colour separations, print devices, PDF input or complex RIP workflows.

2. Replace the component

If the requirement is narrower — converting PS, EPS or XPS files to PDF or images — a purpose-built commercial library can cover it without the same licensing or native-deployment questions.

Choose this if: your usage is conversion and rendering, and you prefer a Maven dependency to a native binary on every host.

3. Drop the feature

If format conversion is a rarely used convenience, removing it may cost less than either licence.

Choose this if: the feature is not important enough to justify a commercial licence or a migration.

Where Aspose.Page fits — and where it does not

Aspose.Page is a good fit if you need to:

  • Convert PostScript (PS) and EPS files to PDF.
  • Convert XPS and OXPS documents to PDF.
  • Render any of those formats to PNG, JPEG, TIFF or BMP.
  • Merge multiple PS or XPS documents.
  • Create and edit XPS documents programmatically.
  • Read and write XMP metadata in EPS files.
  • Crop, resize and transform EPS files.
  • Run conversion inside a closed-source commercial product, server, container or managed platform without installing a native converter.

Aspose.Page is the wrong tool if you need:

  • A full PostScript interpreter or RIP with device-level control.
  • PDF files as input — use Aspose.PDF , which is a different product.
  • CMYK colour separations or prepress-grade print-device output.
  • Ghostscript’s pdfwrite distiller behaviour reproduced exactly.

If you are in the second list, the Artifex commercial licence is the better fit. It will cost less than a migration that cannot reach parity.

What a native converter costs you in a container

Every route from Java to Ghostscript ends at the same requirement: the native binary and its shared libraries must be present wherever your code runs. XPS input needs the `gxps` binary from the same GhostPDL build, so supporting XPS adds a second native dependency rather than avoiding one.

`ghost4j` binds the Ghostscript C API through JNA and loads it into the JVM process. `ProcessBuilder` and `im4java` shell out instead, but they still require the binary. The continuing costs are:

  • UnsatisfiedLinkError in production. The library may be missing, built for the wrong architecture or linked against a different C runtime.
  • Base-image lock-in. Ghostscript packages built against glibc are not interchangeable with musl on Alpine.
  • CVE patching. Ghostscript vulnerabilities become part of your patching and image-rebuild cadence.
  • Process stability. Because ghost4j loads Ghostscript in-process, a native crash takes the JVM down rather than producing a Java exception you can catch.
  • Environment drift. Developer machines, CI runners and production nodes all need compatible native versions. See the technical guide for Docker and serverless deployment .

A pure-Java library removes the native converter from those concerns. You must still configure headless mode and provide the font environment required by your documents.

Ghostscript versus Aspose.Page for Java

  • Licence — Ghostscript: AGPL v3, or commercial from Artifex. Aspose.Page: commercial only.
  • Source disclosure — Ghostscript: required when the AGPL applies. Aspose.Page: not required.
  • Network and SaaS — Ghostscript: network use is within AGPL scope. Aspose.Page: commercial deployment is covered by the purchased licence.
  • Implementation — Ghostscript: native C binary. Aspose.Page: pure Java library.
  • Java integration — Ghostscript: JNA wrapper such as ghost4j, direct JNA or process invocation. Aspose.Page: Maven or Gradle dependency and direct API.
  • Native install — Ghostscript: required on every host. Aspose.Page: no native converter install.
  • Deployment — Ghostscript: binary plus shared libraries in every image. Aspose.Page: JAR with the application.
  • CVE surface — Ghostscript: its native interpreter and dependencies join your patching scope. Aspose.Page: library updates only.
  • Base image — Ghostscript: constrained by compatible native packages and C runtime. Aspose.Page: not constrained by the converter.
  • Input formats — Ghostscript: PS, EPS, PDF and more; XPS needs GhostXPS, a separate interpreter from the same GhostPDL tree. Aspose.Page: PS, EPS, XPS and OXPS in one library.
  • Output and scope — Ghostscript: PDF plus many raster and print devices as a full interpreter and RIP. Aspose.Page: PDF, PNG, JPEG, TIFF and BMP for conversion, rendering and document manipulation.
  • Pricing — Ghostscript: commercial pricing is quoted by Artifex. Aspose.Page: published tiers from US$599.

Migration

PostScript or EPS to PDF

Java conversion replacing the `gs` pdfwrite command

import com.aspose.eps.PsDocument;
import com.aspose.eps.device.PdfSaveOptions;
PsDocument document = new PsDocument("input.ps");
PdfSaveOptions options = new PdfSaveOptions(true);
options.setAdditionalFontsFolders(new String[] { "/opt/fonts" });
document.saveAsPdf("output.pdf", options);
for (Exception ex : options.getExceptions())
{
    System.out.println(ex.getMessage());
}
// Recoverable conversion problems remain available for logging.

Replaces: `gs -sDEVICE=pdfwrite -o output.pdf input.ps`

PostScript or EPS to images

Java conversion replacing the `gs` png16m command

import java.nio.file.Files;
import java.nio.file.Path;
import com.aspose.eps.PsDocument;
import com.aspose.eps.device.ImageSaveOptions;
PsDocument document = new PsDocument("input.ps");
ImageSaveOptions options = new ImageSaveOptions();
byte[][] imagesBytes = document.saveAsImagesBytes(options);
for (int i = 0; i < imagesBytes.length; i++)
{
    Files.write(Path.of("page_" + i + ".png"), imagesBytes[i]);
}
for (Exception ex : options.getExceptions())
{
    System.out.println(ex.getMessage());
}
// The default output format is PNG; one byte array is returned per page.

Replaces: `gs -sDEVICE=png16m -o page_%d.png input.ps`

XPS to PDF

Java XPS-to-PDF conversion

import com.aspose.xps.XpsDocument;
import com.aspose.xps.rendering.PdfSaveOptions;
XpsDocument document = new XpsDocument("input.xps");
PdfSaveOptions options = new PdfSaveOptions();
document.saveAsPdf("output.pdf", options);
// gs does not read XPS; the Artifex equivalent is gxps.

`gs` does not read XPS. The Artifex equivalent is `gxps` from GhostPDL, under the same dual licence.

Which licence do you need?

These published prices were checked on 26 October 2026. Confirm current pricing on the [Aspose.Page for Java pricing page](https://purchase.aspose.com/pricing/page/java).

  • Internal tool, one developer and one deployment location: Developer Small Business — US$599.
  • Embedded in a product distributed to customers, or a public web application: Developer OEM — US$1,797.
  • Distributed as part of an SDK or API you sell: Developer SDK — US$11,980.
  • A team or wider organisation deployment: Site licences are available; see the pricing page.

For a Ghostscript replacement shipped inside a commercial product or public web application, Developer OEM is normally the right tier. It covers one developer, unlimited deployment locations and external distribution.

Perpetual licences include one year of updates, with discounted renewal available.

Try it before you commit

Unlicensed evaluation output carries a watermark. A free 30-day temporary licence removes evaluation limits so you can test your own files before buying.

Bring your most difficult PostScript file. If it does not convert correctly, it is better to find out during evaluation than after purchase.