White Line Appears When Displaying Uploaded DOCX Document Using Aspose (Java)

Hello,

I’m encountering an issue in my Java application where I’m using Aspose to handle DOCX and other Word documents. After uploading a document to the system, a white line appears in the document preview, even though it is not present in the original file.

Additionally, I’ve noticed that a black border (around a text box or shape) appears slightly thicker than in the original document.

I’ve attached a screenshot to help illustrate both issues.
Has anyone experienced something similar, or does anyone know what could be causing this?

Any suggestions would be greatly appreciated.

Best regards,
Kris

@Kawis77

It seems you are experiencing issues with a white line appearing in the document preview after uploading a DOCX file using Aspose in your Java application. Additionally, you mentioned that a black border around a text box or shape appears thicker than in the original document.

Here are a few suggestions to troubleshoot and potentially resolve these issues:

  1. Rendering Quality Options: You can adjust the rendering quality options when saving the document as an image. This can help mitigate issues like unwanted lines or borders. For instance, you can set the GraphicsQualityOptions to improve the rendering quality. Here’s a code snippet that demonstrates how to set these options:

    Document doc = new Document("path/to/your/document.docx");
    ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.PNG);
    GraphicsQualityOptions qualityOptions = new GraphicsQualityOptions();
    qualityOptions.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    saveOptions.setGraphicsQualityOptions(qualityOptions);
    doc.save("path/to/save/image.png", saveOptions);
    
  2. Use Tile Flip Mode: If you are rendering at a high resolution, enabling the tile flip mode can help prevent white lines from appearing. You can set this option as follows:

    saveOptions.getGraphicsQualityOptions().setUseTileFlipMode(true);
    
  3. Check Document Elements: Sometimes, the appearance of lines or borders can be due to specific elements in the document itself. Ensure that there are no hidden elements or formatting issues in the original DOCX file that could be causing these artifacts.

  4. Update Aspose Library: Ensure that you are using the latest version of the Aspose library, as updates often include bug fixes and improvements that could resolve rendering issues.

If these suggestions do not resolve the problem, consider providing a minimal reproducible example along with the document that exhibits the issue. This can help in diagnosing the problem more effectively.

Feel free to reach out if you have further questions or need additional assistance!

@Kawis77 Could you please attach your problematic input and output documents? We will check the issue and provide you more information. Which format do you use for previewing document?

To transfer the file after sending we use pdf. I am sending the document (problem with the white line)
test white line2.docx (18,1 KB)

@Kawis77 The problem is not reproducible on my side. Here is the produced PDF:
out.pdf (40.7 KB)

and the screenshot:

Most likely the problem is with your PDF viewer.

Thanks for checking the problem

1 Like