Remove comments pdf during Word to PDF with GroupDocs Java

Converting Word documents to PDF is a daily task for many developers, but when the source files contain reviewer notes, tracked changes, or comment balloons, you often need a clean PDF without any of that markup. In this tutorial you’ll learn how to remove comments pdf during the conversion process using GroupDocs.Conversion for Java. We’ll walk through the Maven setup, the exact code you need, and practical tips to keep your PDFs professional, privacy‑safe, and ready for distribution.

Quick answers

  • What does “remove comments pdf” do? It strips all comment balloons and annotation layers from the generated PDF while preserving the main document content.
  • Which library handles this? GroupDocs.Conversion for Java provides a WordProcessingLoadOptions.setHideComments(true) flag that performs the removal automatically.
  • Do I need a license? A free trial works for testing; a commercial license is required for production use.
  • Can I hide tracked changes at the same time? Yes – call loadOptions.setHideTrackChanges(true) together with setHideComments(true).
  • Is batch conversion supported? Absolutely; you can loop over multiple files with the same settings and achieve high‑throughput processing.

What is “hide comments word pdf”?

Loading a Word document with the hide comments option tells the converter to omit every comment balloon, footnote‑style note, and annotation from the final PDF. The result is a clean, comment‑free PDF that looks exactly like the original content but without any reviewer markup.

Why hide comments during conversion?

Hiding comments during conversion protects sensitive reviewer feedback, ensures client‑facing PDFs look polished, and helps you meet compliance requirements that forbid the distribution of internal editorial metadata. By removing these elements you also reduce file size by up to 15 % for heavily annotated documents.

Prerequisites

Before you begin, make sure you have the following:

  • Java Development Kit (JDK) 8 or higher installed on your machine.
  • Maven for dependency management.
  • A GroupDocs.Conversion for Java license (the free trial works for testing).

Required libraries, versions, and dependencies

Add the GroupDocs repository and dependency to your pom.xml exactly as shown below:

<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/conversion/java/</url>
   </repository>
</repositories>
<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-conversion</artifactId>
      <version>25.2</version>
   </dependency>
</dependencies>

Pro tip: Keep the <version> up to date with the latest stable release to benefit from performance improvements and bug fixes.

Setting up GroupDocs.Conversion for Java

  1. Maven installation – The snippet above pulls the library into your project automatically.
  2. License acquisition – Register for a free trial on the GroupDocs website or purchase a permanent license for production workloads.
  3. Basic initialization – Once Maven resolves the dependency, you can import the classes directly in your Java code.

Implementation guide – how to hide comments in Word‑to‑PDF conversion

Below is a concise, step‑by‑step walkthrough. Each step includes a short explanation followed by the exact code you need. Do not modify the code blocks – they are required for the tutorial to remain valid.

Step 1: Load options configuration (hide comments)

The WordProcessingLoadOptions class lets you control how a Word document is loaded, including the ability to hide comments and tracked changes.

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.WordProcessingLoadOptions;

// Configure load options
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
loadOptions.setHideComments(true); // Hide comments in the output PDF

Step 2: Initialize the converter with your source document

The Converter class is the core engine that transforms a source document into the desired output format, applying any load‑option settings you defined.

String sourceDocument = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_DOCX_WITH_TRACKED_CHANGES";
Converter converter = new Converter(sourceDocument, () -> loadOptions);

Step 3: Convert to PDF

The PdfConvertOptions class holds PDF‑specific conversion settings such as image compression, resolution, and font embedding. Using the default options is sufficient for most scenarios.

PdfConvertOptions convertOptions = new PdfConvertOptions(); // Default PDF settings
String outputPdf = "YOUR_OUTPUT_DIRECTORY/ConvertWordProcessingByHiddingComments.pdf";

// Perform conversion
converter.convert(outputPdf, convertOptions);

Note: The convert method blocks until the PDF is fully written to disk. For large batches, consider running conversions in parallel threads.

Common issues and solutions

SymptomLikely causeFix
File not found errorIncorrect source or output pathVerify that sourceDocument and outputPdf point to existing directories.
Comments still appear in the PDFsetHideComments not called or overwrittenEnsure you call loadOptions.setHideComments(true) before creating the Converter.
Maven cannot resolve the dependencyRepository URL typo or network blockDouble‑check the <url> in the <repository> block and ensure your firewall allows access to releases.groupdocs.com.

Practical applications (why this matters)

  1. Legal contracts – Remove internal review notes before filing official copies.
  2. Educational handouts – Distribute clean lecture PDFs without instructor markup.
  3. Business proposals – Present a polished PDF to clients, free of internal comments.

Performance considerations

  • Memory management – Large Word files can consume significant heap space. Use -Xmx JVM options to increase the heap if needed.
  • Garbage collection – Invoke System.gc() after a large batch to free memory promptly (use sparingly).
  • Profiling – Tools like VisualVM can help you spot bottlenecks in the conversion pipeline.
  • Scalability – GroupDocs.Conversion processes multi‑hundred‑page documents without loading the entire file into memory, supporting files up to 500 MB in size.

Frequently asked questions

Q: Can I hide tracked changes as well?
A: Yes. Call loadOptions.setHideTrackChanges(true); in addition to setHideComments(true).

Q: Is batch conversion possible?
A: Absolutely. Loop over a collection of file paths, reusing the same loadOptions and PdfConvertOptions for each iteration.

Q: What should I do if Maven fails to download the GroupDocs artifact?
A: Verify the repository URL, ensure your internet connection is stable, and check that your settings.xml does not block external repositories.

Q: How can I improve PDF output quality?
A: Adjust properties on PdfConvertOptions such as setResolution(300) or setCompressImages(true) to fine‑tune the result.

Q: Does GroupDocs.Conversion support other formats besides Word and PDF?
A: Yes. The API covers 120+ input and output formats—including Excel, PowerPoint, images, and CAD files—allowing you to build universal document pipelines.

Resources


Last updated: 2026-09-10
Tested with: GroupDocs.Conversion 25.2 for Java
Author: GroupDocs