Table in DOCX looks different in PDF documents

I created a document with Microsoft Word and I exported it as PDF. When I opened the DOCX document the table border looks ok, but when I open the PDF the border looks different, in gray color.

See the screenshot, in the left side, is the DOCX document and on the right side is the PDF document.

Screenshot:
DOCX:
PDF: gd21-link-table-encode-pdf.pdf (182.2 KB)

Git project: GitHub - groupdocs-viewer/GroupDocs.Viewer-for-Java: GroupDocs.Viewer for Java examples, plugins and showcase
Git branch: master
Git revision: f75a0b7
SO: Windows 10
Java version: Oracle JDK 1.8.0_201 and Redhat OpenJDK 11.0.10
table-looks-different-in-word-pdf.png (50.3 KB)
gd21-link-table-encode-docx.docx (23.7 KB)
gd21-link-table-encode-pdf.pdf (182 KB)

@john.mcqueide

In case you’re rendering PDF and DOCX documents different rendering engines are used. When rendering PDF to HTML the table is a part of the background PNG image see background-image.png (2.4 KB) and when you scaling the page borders become blurry. When rendering DOCX to HTML the table borders is built with separate div blocks and as a result, the quality is better.
We have created an issue with ID VIEWERJAVA-2776 for the further investigation.

1 Like

Hello, is there any update about this topic?

@john.mcqueide

We’ve completed the investigation of this issue. The borders look different since we’re using two distinct rendering engines to render DOCX and PDF documents. The borders in DOCX files are rendered as <div> elements while the borders in PDF documents are rendered as a background image. You can improve the quality of the background image by setting HtmlViewOptions.getPdfOptions().setImageQuality(ImageQuality.HIGH); see image-quality-high.png (92.0 KB).

1 Like