Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active October 1, 2025 06:37
Show Gist options
  • Save aspose-com-gists/b9c9c0eb44f17af6fe4c7291c51c8930 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/b9c9c0eb44f17af6fe4c7291c51c8930 to your computer and use it in GitHub Desktop.
Learn about Aspose.HTML for Java library – benefits and supported features, performance and scalability, learning, and technical support.

Aspose.HTML for Java – Getting Started

This gist repository contains ready-to-use Java snippets to help you get started with Aspose.HTML for Java: apply a license, use metered licensing, and convert HTML to PDF. These examples are used in the Getting Started chapter of the documentation and are intended for quick experimentation and learning.

Topics Covered

  1. Apply license files from disk or stream.
  2. Use metered licensing with public/private keys.
  3. Convert HTML to PDF and other formats.

Prerequisites

  • J2SE 1.8 or higher.
  • Supported OS: Windows, macOS, Linux.
  • Java IDE (IntelliJ IDEA, Eclipse, or similar).
  • Build tool: Maven or Gradle for dependency management.

How to Use These Examples

  1. Install or reference Aspose.HTML for Java in your project – download packages and view release notes on the product releases page.
  2. Configure the Aspose repository and add the Aspose.HTML dependency as described in the official installation guide.
  3. Browse the available gists and copy the code samples you need.
  4. Open the example files in your IDE, update file paths or output locations, and run the samples.

Licensing and Evaluation

You can evaluate Aspose.HTML for Java with a temporary license (30-day full-feature trial). For production use, apply a purchased license or use metered licensing as shown in the examples.

Support and Resources

Aspose.HTML for Java - Getting Started
// Convert HTML to PDF in one line of code using Java
// Learn more: https://docs.aspose.com/html/java/getting-started/
// Invoke the ConvertHTML method to convert the HTML to PDF
Converter.convertHTML("<span>Hello, World!!</span>", ".", new PdfSaveOptions(), "output.pdf");
// Set Aspose.HTML for Java license using file path string
// Learn more: https://docs.aspose.com/html/java/getting-started/licensing/
// instantiate License object
com.aspose.html.License license = new com.aspose.html.License();
// license file path information
license.setLicense("Aspose.HTML.lic");
// Set Aspose.HTML for Java license from stream
// Learn more: https://docs.aspose.com/html/java/getting-started/licensing/
// Initialize License Instance
com.aspose.html.License license = new com.aspose.html.License();
// Set license from Stream
license.setLicense(new java.io.FileInputStream("Aspose.HTML.lic"));
// Set Aspose.HTML for Java metered license using public and private keys with Metered class
// Learn more: https://docs.aspose.com/html/java/getting-started/licensing/
// Initialize a metered object
com.aspose.html.Metered metered = new com.aspose.html.Metered();
// Apply the metered license using the public and private keys
metered.setMeteredKey("PublicKey", "PrivateKey");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment