Applying License Keys in IronPDF for Java
Applying a license key to IronPDF for Java unlocks full production capability. Without a valid license key, IronPDF runs in trial mode and stamps a watermark on every generated PDF (acceptable for development and evaluation) but not suitable for live deployment. This guide walks through three ways to apply a license key: in Java code at startup, via a config.properties file, and how to verify the key is active.
Minimal Workflow (4 steps)
- Add IronPDF to your
pom.xmlas a Maven dependency (or download the.jardirectly). - Call
License.setLicenseKey("YOUR-LICENSE-KEY")at the very start of your application, before any IronPDF class is used. - Alternatively, set
IRONPDF_LICENSE_KEY=YOUR-LICENSE-KEYin yourconfig.propertiesfile. - Call
License.isValidLicense("YOUR-LICENSE-KEY")to confirm the key is active.
How Do You Get an IronPDF License Key?
IronPDF for Java is free to evaluate in development. In trial mode, every PDF produced carries an IronPDF watermark. To remove the watermark and deploy to production, a paid or trial license key is required.
Two options are available:
- Purchase a license: visit the IronPDF Java licensing page to choose a plan that fits your deployment needs.
- Start a free 30-day trial: request a trial license key to evaluate IronPDF without restrictions in a live environment.
Once the key arrives by email, keep it available for the steps below. The same key works for code-based and file-based application methods.
How Do You Add IronPDF as a Java Dependency?
Before applying a license key, IronPDF must be on the classpath. There are two ways to achieve this: declare it as a Maven dependency or add the .jar file manually.
Option 1: Maven (pom.xml)
Add the following two entries to the <dependencies> block in your pom.xml. The first pulls in the IronPDF library; the second adds the SLF4J logger that IronPDF uses internally.
<dependencies>
<!-- IronPDF for Java — use the latest release version -->
<dependency>
<groupId>com.ironsoftware</groupId>
<artifactId>ironpdf</artifactId>
<version>20xx.xx.xxxx</version>
</dependency>
<!-- SLF4J simple logger required by IronPDF -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
Replace 20xx.xx.xxxx with the latest IronPDF for Java version. After saving pom.xml, run mvn install (or let your IDE sync) to download the dependency.
Option 2: Manual JAR
If Maven is not part of the build toolchain, download the IronPDF Java .jar file and add it to the project's classpath manually. This approach suits Ant-based builds or projects that manage dependencies without a package manager.
How Do You Apply a License Key in Java Code?
The most direct method is to call License.setLicenseKey() at the very beginning of application startup, before any PDF operation runs. Placing the call in the main method is the safest approach.
import com.ironsoftware.ironpdf.License;
public class MyApplication {
public static void main(String[] args) {
// Apply your license key before using any IronPDF feature
License.setLicenseKey("IRONPDF-MYLICENSE-KEY-1EF01");
// IronPDF is now fully licensed — no watermarks on output PDFs
System.out.println("IronPDF license applied.");
}
}
This approach works in all Java project types: standalone applications, Spring Boot services, Jakarta EE applications, and Android projects. The key is stored in memory for the lifetime of the JVM process; no file system writes occur.
How Do You Apply a License Key Through a Config File?
For projects that separate configuration from code, such as twelve-factor applications or deployments that rotate keys without a redeploy, the config.properties file method is preferable.
Add one line to config.properties:
IRONPDF_LICENSE_KEY=IRONPDF-MYLICENSE-KEY-1EF01
Place the file in the working directory of the running application or on the classpath root. IronPDF reads this property automatically at startup. No code changes are required when the key changes; update the file and restart the process.
How Do You Verify That the License Key Is Active?
After applying a key by either method, License.isValidLicense() confirms whether IronPDF recognizes it as valid. Add this check to a startup routine or a health-check endpoint.
import com.ironsoftware.ironpdf.License;
public class LicenseVerification {
public static void main(String[] args) {
String licenseKey = "IRONPDF-MYLICENSE-KEY-1EF01";
// Returns true if the key is valid and the license is active
boolean isValid = License.isValidLicense(licenseKey);
if (isValid) {
System.out.println("License is valid — watermarks are disabled.");
} else {
System.out.println("License is invalid or expired. PDFs will include a trial watermark.");
}
}
}
License.isValidLicense() returns true when the key format is correct, the license has not expired, and the key matches the product. It returns false for malformed keys, expired trial keys, or keys issued for a different Iron Software product. After any license change, clean and rebuild the project before running this check to avoid stale class data affecting the result.
IronPDF for Java: Trial vs. Licensed Behavior
| Behavior | Trial Mode (no key) | Licensed Mode |
|---|---|---|
| PDF watermark | Yes, on every page | No |
| Production deployment | Not permitted | Permitted |
| Feature access | Full API available | Full API available |
| License.isValidLicense() | Returns false | Returns true |
What Are the Next Steps?
With a valid license key applied, IronPDF for Java is ready for production use. The following resources help move from setup to implementation:
- Get Started with IronPDF for Java: the official getting-started tutorial covering HTML-to-PDF rendering, PDF reading, and common document operations.
- IronPDF Java Code Examples: a library of runnable examples covering PDF creation, editing, stamping, form filling, and more.
- IronPDF Java API Reference: full method and class documentation for the
com.ironsoftware.ironpdfpackage. - Purchase or upgrade a license: scale from a single developer license to an enterprise or OEM deployment as the project grows. Start a free trial if evaluation is still ongoing.
For technical questions, the IronPDF support team is available via live chat and email.
Frequently Asked Questions
How can I apply an IronPDF license key in Java?
You can apply an IronPDF license key in Java by using License.setLicenseKey('YOUR-LICENSE-KEY') at the start of your application, or by setting IRONPDF_LICENSE_KEY=YOUR-LICENSE-KEY in a config.properties file.
What happens if I don't apply a license key in IronPDF for Java?
Without a valid license key, IronPDF operates in trial mode and applies a watermark on each generated PDF, which is not suitable for live deployment.
How do I verify if my IronPDF license key is active?
You can verify if your license key is active by using License.isValidLicense('YOUR-LICENSE-KEY'), which returns true if the key is valid.
Can I use IronPDF for Java without purchasing a license?
You can evaluate IronPDF for Java for free in trial mode, but a license is needed to deploy in production and remove watermarks.
What are the two ways to add IronPDF as a dependency in Java?
You can add IronPDF as a dependency by either adding it to your pom.xml file using Maven or by manually downloading the .jar file and adding it to your project's classpath.
What is the purpose of the config.properties file in IronPDF license application?
The config.properties file allows you to apply a license key without code changes, as IronPDF reads the license property automatically at startup.
What should I do if my license key is invalid?
Ensure that the key format is correct, the key is valid for IronPDF, and it has not expired. If issues persist, contact IronPDF support for assistance.
Does IronPDF for Java require any additional libraries?
Yes, when using Maven, IronPDF for Java requires the SLF4J simple logger, which must be added to the pom.xml.
Can I automate license key changes in a production environment?
Yes, by using a config.properties file, you can automate key changes without needing to modify the code and simply update the file as required.
How does the license key affect the behavior of IronPDF for Java?
A valid license key enables production deployment and removes PDF watermarks. In trial mode (without a key), watermarks are included, and production deployment is not permitted.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.