pdf.js: New soft mask method causes some text not to be rendered

Half of the text on this restaurant menu PDF does not render in current versions of PDF.js. I remembered that this PDF used to render correctly in Firefox, so I ran git bisect and identified commit 2d1f9ff7a3a8e29acd7500add4a1057a5eaba191 as the change which introduced the regression.


Attach (recommended) or Link to PDF file here: Tillamook-Market-Menu-04.04.22.pdf

Configuration:

  • Web browser and its version: Firefox 101.0 arm64
  • Operating system and its version: macOS 12.4
  • PDF.js version: git master (19539676813b5df6ca4726a1bfa6765193b1067c)
  • Is a browser extension: No

Steps to reproduce the problem:

  1. Open the PDF.
  2. Observe that roughly half the text on the menu does not appear.

What is the expected behavior? (add screenshot) Screen Shot 2022-06-02 at 8 47 03 PM

What went wrong? (add screenshot) Screen Shot 2022-06-02 at 8 47 12 PM

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): n/a

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

What would you all think about adding maxGroupSize as an option in PDFViewerOptions? I tried adding this as an option in my fork and passing it through to CanvasGraphics. I set the value to the height of the tall pdf I am trying to render and it seems to work for that use case.

Another (better?) option here may be to add something like useGroupSize as a boolean in PDFViewerOptions and then just skip the block at pdf.js/src/display/canvas.js if true.

@calixteman - it sounds like you have an idea for a more robust approach but I wanted to present this idea as well.

Hello! We have a 2 big customers with the same problem, please, post here any updates (@Snuffleupagus would be so much appreciated)

Thanks for looking into this @Snuffleupagus and @calixteman.

@Snuffleupagus - you mentioned:

Maybe we should consider increasing the limit a little bit by default

If the document is very tall, it still gets clipped if the document is smaller than MAX_GROUP_SIZE. I’m not sure if increasing the limit a little bit would work.

What would you all think about adding maxGroupSize as an option in PDFViewerOptions? I tried adding this as an option in my fork and passing it through to CanvasGraphics. I set the value to the height of the tall pdf I am trying to render and it seems to work for that use case.

Tbh I don’t really know what’s the best here. I agree with you about the memory but having this limit and consequently an upscale could induce some bluriness. Anyway, I think I found what’s wrong.