Hi everyone,
I’m running into a rendering bug when opening certain PDFs in ONLYOFFICE. A specific PDF (an officially signed government form, generated by a third-party e-signature/e-registration platform) displays a large solid black rectangle covering part of the page. The same file opens perfectly in Adobe Acrobat Reader and in browser PDF viewers (Chrome, Firefox, Edge), so the file itself is not corrupted — this looks like a rendering issue specific to ONLYOFFICE.
Root cause (as far as I could determine):
The affected area is an image XObject that uses a stencil mask to draw a strip of small vertical text (in the original file, a signature/timestamp annotation added by the signing platform). The image dictionary looks like this:
<<
/Type /XObject
/Subtype /Image
/Width 412
/Height 1067
/ColorSpace /DeviceRGB
/BitsPerComponent 8
/Filter /FlateDecode
/Mask <<
/Type /XObject
/Subtype /Image
/ImageMask true
/Width 412
/Height 1067
/Decode [1 0]
/Filter /FlateDecode
>>
>>
The base image itself is fully black (RGB 0,0,0 everywhere). It’s meant to be almost entirely masked out by the /Mask stencil (an ImageMask with Decode [1 0]), so that only the thin text-shaped area is actually painted, leaving the rest transparent. Adobe and other renderers apply the stencil mask correctly and only the text is visible. ONLYOFFICE appears to ignore the /Mask entry and paints the entire base image, resulting in a solid black block.
Steps to reproduce:
-
Open the attached minimal test PDF (
stencil_mask_bug_minimal.pdf) in ONLYOFFICE (Desktop Editors or Document Server/online). -
Expected: a page with a short paragraph of instructions, followed by a narrow strip containing rotated placeholder text (“Signed by TEST USER…”), with a transparent/white background around the text.
-
Actual: the strip renders as a solid black rectangle, hiding the text.
-
For comparison, open the same file in Adobe Acrobat Reader or a browser — the mask is applied correctly and the text is visible.
I’ve attached a minimal PDF that reproduces the issue with a synthetic image (no personal or sensitive data) — it uses the same /Mask + ImageMask + Decode [1 0] technique as the original document that triggered the bug.
Environment:
-
ONLYOFFICE version: comunitaria 9.4.0.129 (x64 exe)
-
OS: Windows 11 Pro
-
Edition: Desktop Editors
Happy to provide more details or test further builds. Thanks!
Attachment to upload with the post: stencil_mask_bug_minimal.pdf