Browse our Products
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-html</artifactId>
<version>18.11.1</version>
</dependency>
compile(group: 'com.aspose', name: 'aspose-html', version: '18.11.1')
<dependency org="com.aspose" name="aspose-html" rev="18.11.1">
<artifact name="aspose-html" ext="jar"/>
</dependency>
libraryDependencies += "com.aspose" % "aspose-html" % "18.11.1"
HTML File Manipulation Java API
Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License
The Java HTML API assists developers to write, read, modify, navigate and convert (X)HTML documents from within Java applications.
Aspose.HTML for Java API works as a headless browser that allows you to create or open existing HTML documents from various sources in order to perform manipulation operations such as remove and replace HTML nodes, save HTML documents, extract CSS from HTML, configure a document sandbox and more. You may navigate HTML documents by using various methods, such as, element traversal, document traversal, XPath queries, and CSS selector queries as well as manipulate HTML DOM via JavaScript, convert HTML file to images or fixed layout formats, and convert XHTML and EPUB files to other file formats.
HTML Processing Features
- Written completely in Java and works with JRE.
- Supports both the
32-bit
&64-bit
OS support. - Create or open an existing HTML document from different sources.
- Ability to manipulate (create, edit, remove, replace) HTML nodes via API.
- Extract CSS styles for specific HTML node.
- Configure a document sandbox that affects the processing of HTML documents.
- Supports navigation through HTML document in various ways (Element Traversal, Document Traversal, XPath queries, CSS Selector queries).
- Manipulate HTML DOM via JavaScript.
- Convert web documents to various supported file formats.
- Extract text from pages.
- Search text from pages.
- Add text in HTML file.
- Create, edit, remove and replace HTML nodes
- Extracting CSS styles for particular HTML node
- Convert HTML documents into various supported image formats: JPEG, PNG, BMP, TIFF
- Convert HTML documents to PDF format
- Convert HTML documents to XPS format.
Read & Write Web Formats
Web: HTML, XHTML^, MHTML^^
Other: SVG*, MD**
Save HTML As
Fixed Layout: PDF, XPS
Images: TIFF, JPEG, PNG, BMP
Read Formats
Images: EPUB
Supported Environments
- Microsoft Windows: Windows Desktop & Server (x86, x64)
- macOS: Mac OS X
- Linux: Ubuntu, OpenSUSE, CentOS, and others
- Java Versions:
J2SE 6.0 (1.6)
,J2SE 7.0 (1.7)
,J2SE 8.0 (1.8)
Get Started
Aspose.HTML Java APIs are hosted at the Aspose Repository. You can easily use Aspose.HTML for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit Installing Aspose.HTML for Java from Aspose Repository documentation page.
Load HTML from a Remote Location
HTMLDocument document = HTMLDocument(new Url("template.html"));
// read children nodes and get length information
if (document.getBody().getChildNodes().getLength() == 0)
System.out.println("No ChildNodes found...");
// print Document URI to console. As per information above, it has to be https://www.w3.org/TR/html5/
System.out.println("Print Document URI = " + document.getDocumentURI());
// print domain name for remote HTML
System.out.println("Domain Name = " + document.getDomain());
How to use the Examples?
Clone or Download the ZIP and extract the contents to your local hard drive. This project uses Maven/Gradle build system and can be opened in any modern IDE like IntelliJ IDEA, Eclipse or NetBeans. For more details, visit our Documentation website.
Step one
For maven
mvn compile test
For gradle
gradle build
Execute all tests
Maven
mvn -Dtest="com.aspose.html.examples.**" test
Gradle
./gradlew test --tests "com.aspose.html.examples.*"
Execute single test
Maven
mvn -Dtest=Examples_Java_AdvancedUsage_DOMMutationObserver_ObserveHowNodesAreAdded test
Gradle
./gradlew test --tests "com.aspose.html.examples.Examples_Java_AdvancedUsage_DOMMutationObserver_ObserveHowNodesAreAdded"
Execute asynchronously test in Thread
Maven
mvn org.codehaus.mojo:exec-maven-plugin:3.0.0:java -Dexec.mainClass="com.aspose.html.examples.SimpleWait" -Dexec.classpathScope="test" -Dexec.cleanupDaemonThreads=false
Gradle
./gradlew SimpleWait
Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License
Version | Release Date |
---|---|
24.10 | October 1, 2024 |
24.9 | September 5, 2024 |
24.8 | August 8, 2024 |
24.7 | July 7, 2024 |
24.6 | June 21, 2024 |
24.5 | June 4, 2024 |
24.4 | April 4, 2024 |
24.3 | March 22, 2024 |
24.2 | February 15, 2024 |
24.1 | January 24, 2024 |
23.12 | December 30, 2023 |
23.11 | November 30, 2023 |
23.10 | October 30, 2023 |
23.8 | August 3, 2023 |
23.5.1 | May 15, 2023 |
23.5 | May 3, 2023 |
23.4 | April 26, 2023 |
23.1 | January 16, 2023 |
22.9 | September 20, 2022 |
22.8 | August 30, 2022 |
22.7 | July 20, 2022 |
21.12 | January 16, 2022 |
21.6 | July 1, 2021 |
21.5 | May 31, 2021 |
21.4 | May 2, 2021 |
21.3 | April 1, 2021 |
20.12 | December 27, 2020 |
20.9.1 | October 6, 2020 |
20.8 | August 30, 2020 |
20.6 | June 26, 2020 |
19.9 | September 25, 2019 |
19.8 | August 27, 2019 |
19.7 | July 29, 2019 |
19.6 | June 5, 2019 |
19.5 | May 16, 2019 |
19.4 | April 21, 2019 |
19.3 | March 28, 2019 |
18.11.1 | November 21, 2018 |
18.11 | November 20, 2018 |
18.10.2 | October 30, 2018 |
18.10.1 | October 26, 2018 |
18.10 | October 19, 2018 |
18.8 | August 15, 2018 |
18.6 | July 23, 2018 |
18.5.1 | June 19, 2018 |
18.5 | June 1, 2018 |
17.12 | February 7, 2018 |
17.11.1 | December 19, 2017 |
17.11 | November 29, 2017 |
17.10 | November 1, 2017 |
17.9 | September 29, 2017 |
17.8 | August 29, 2017 |
File | Classifier | Size |
---|---|---|
aspose-html-18.11.1-javadoc.jar | javadoc | 3.28 MB |
aspose-html-18.11.1.jar | 16.15 MB | |
aspose-html-18.11.1.pom | 396 bytes |
Aspose Total Aspose HTML Aspose Java API html java library html java class Maven html converter svg converter mhtml converter markdown converter template converter html to image html to pdf html to xps html to mhtml html to markdown svg to image svg to pdf svg to xps epub to image epub to pdf epub to xps mhtml to image mhtml to pdf mhtml to xps markdown to html html template html navigation html5 DOM html form editor css extension