Comments are showing inline when docx is converted to PDF

We are using groupdocs java library to convert docx documents to PDF. When docx document have comments in it ( even though all the comments are resolved ), still the converted PDF is showing the comments in-line.

Expectation is that, comments should not be shown in pdf as they are already resolved in docx.

groupdocs-pdf.png (25.0 KB)

@sarfraz.ahmad

To ensure that comments do not appear in the PDF when converting a DOCX document using the GroupDocs Java library, you need to set the HideComments option to true in your conversion settings. This option is designed to hide comments, including resolved ones, during the conversion process.

Here is a sample code snippet demonstrating how to implement this in Java:

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

public class ConvertWordProcessingByHidingComments {
    public static void main(String[] args) {
        String inputFilePath = "path/to/your/input.docx";
        String outputFilePath = "path/to/your/output.pdf";

        // Set load options to hide comments
        WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
        loadOptions.setHideComments(true);

        // Create a converter instance
        try (Converter converter = new Converter(inputFilePath, () -> loadOptions)) {
            PdfConvertOptions pdfOptions = new PdfConvertOptions();
            converter.convert(outputFilePath, pdfOptions);
            System.out.println("Document converted successfully. Check output at: " + outputFilePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Make sure you are using a version of the GroupDocs library that supports this feature. If you are still seeing comments in the output PDF, it may be worth checking if you are using an outdated version of the library, as this issue has been addressed in more recent updates.

If you continue to experience issues, consider checking the documentation or forums for any additional settings that may be required for your specific use case.

1 Like