Summarize Word, PDF, Web documents in Java

Java solution for summarizing documents using AI

Seamless integration with major language models such as OpenAI and Gemini provides extensive AI-based document processing capabilities for Java applications.

View code snippet

Intelligent Text Summarization for Java Applications

Extract key information from texts and documents programmatically. Generate concise, informative summaries that capture the meaning of text using large language models (LLM) in Java. The applications of software text summarization are vast and varied. Text summarization can be used to provide up-to-date information on current events. By integrating text summarization function into your software, you will not only increase productivity, but also improve decision making by accessing important data as quickly as possible.

Key Features

  • Easy-to-use API that easily integrates with Java software
  • Ability to integrate with various LLM models to meet your needs
  • Ability to customize text summarization settings
  • Support for a wide range of file formats

The interaction between Aspose.Words and Large Language Models is built on a REST architecture. This approach provides reliable and secure communication between your Java application and various AI services. To set up authentication, you will need to specify your private API key and the `endpoint` of the AI service that provides the models you need (GoogleAiModel, OpenAiModel). For a full list of supported LLM types, see the API Reference.

Experience the future of intelligent text processing in Java today!

Example code in Java for summarizing a document
Select the target format from the list
Run code
// Repository path: https://releases.aspose.com/java/repo/
// Maven, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-words</artifactId>
  <version>ver</version>
  <classifier>jdk17</classifier>
</dependency>
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Gradle, where 'ver' - Aspose.Words version number, for example, 24.4.
compile(group: 'com.aspose', name: 'aspose-words', version: 'ver', classifier: 'jdk17')
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Ivy, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency org="com.aspose" name="aspose-words" rev="ver">
 <artifact name="aspose-words" m:classifier="jdk17" ext="jar"/>
</dependency>
Copy
// Repository path: https://releases.aspose.com/java/repo/
// Sbt, where 'ver' - Aspose.Words version number, for example, 24.4.
libraryDependencies += "com.aspose" % "aspose-words" % "ver"
Copy
Document doc = new Document("Document.docx");

String apiKey = System.getenv("API_KEY");

// Use OpenAI or Google generative language models.
IAiModelText model = (IAiModelText) AiModel.create(AiModelType.GPT_4_O_MINI).withApiKey(apiKey);

SummarizeOptions options = new SummarizeOptions();
options.setSummaryLength(SummaryLength.SHORT);
Document summary = model.summarize(doc, options);
summary.save("Output.pdf")
Run code

How to summarize a document in Java

  1. Install Aspose.Words for Java.
  2. Add a library reference (import the library) to your Java project.
  3. Open the source file in Java.
  4. Invoke method, passing in your document along with the SummarizeOptions parameter.
  5. Once completed, you will receive a concise document summary that you can save as a new file in the format you need.

Java library to summarize documents

We host our Java packages in Maven repositories. 'Aspose.Words for Java' is a common JAR file containing byte-code. Please follow the step-by-step instructions on how to install it to your Java developer environment.

System Requirements

Java SE 7 and more recent Java versions are supported. We also provide a separate package for Java SE 6 in case you are obliged to use this outdated JRE.

Our Java package is cross-platform and runs on all operating systems with JVM implementation, including Microsoft Windows, Linux, macOS, Android and iOS.

For information on optional package dependencies, such as JogAmp JOGL, Harfbuzz font engine, Java Advanced Imaging JAI, please refer to Product Documentation.

5%

Subscribe to Aspose Product Updates

Get monthly newsletters and offers directly delivered to your mailbox.

© Aspose Pty Ltd 2001-2025. All Rights Reserved.