Hidden Text Becomes Visible in GroupDocs.Viewer Due to Incorrect Rendering Layer Order

Hi GroupDocs Support,

I encountered a rendering issue using GroupDocs.Viewer when previewing a PDF document.

In the original PDF, there is some text that is intentionally hidden behind a filled rectangle or shape (used for masking or redaction purposes). When I open the document in Adobe Acrobat or Chrome PDF Viewer, the text is correctly blocked/covered and not visible.

However, when the same document is rendered using GroupDocs.Viewer, the text appears visible, because the blocking shape is rendered behind the text, not in front of it as intended. This appears to be a layering issue (Z-ordering) in the rendering engine.

It seems that GroupDocs:

  • Converts the PDF content to an image (or HTML layout),
  • But draws the text layer above image-based content (even if the text was originally underneath a shape).

This leads to previously hidden or intentionally blocked content becoming clearly visible, which is a major concern for confidentiality.

:paperclip: Steps to Reproduce:

  1. Open the attached PDF (IN0001_2022-23.pdf) in Adobe Acrobat — observe the text behind shapes is properly blocked.
  2. Render the same document using GroupDocs.Viewer in HTML mode.
  3. Observe that the blocked text becomes visible, because the overlaying shape is rendered behind the text.

IN0001_2022-23.pdf (166.9 KB)

1 Like

@fadip

Hi Frangky,

The reported issue with the numbers, which are located in the table cells and are occluded by the shapes, but are visible in the GroupDocs.Viewer, is not a bug, but rather a feature, a default behavior, intended to provide the all the textual data on the page. However, it is possible to mimic the behavior of Adobe Reader (or any other PDF reader) using the HtmlViewOptions class. In particular, need to set the true value to the EnableLayeredRendering flag in the PdfOptions, as it is shown on example below:

HtmlViewOptions embeddedHtmlOpt = HtmlViewOptions.ForEmbeddedResources("page-{0}.html");
embeddedHtmlOpt.PdfOptions.EnableLayeredRendering = true;

using (Viewer viewer = new Viewer("IN0001_2022-23.pdf"))
{
    viewer.View(embeddedHtmlOpt);
}

As a result, you will obtain the HTML-representation of the original PDF page, as it can be seen in Adobe Reader. I’ve attached this output HTML in ZIP archive to this topic, you can find it below.

IN0001_2022-23-embedded-page1.zip (97.7 KB)

Also this flag is described in official documentation here.

Hope this helps.

With best regards,
Denis Gvardionov