This avoids repeating the same code multiple times, and as part of the changes we'll also utilize existing PDF.js helpers more.
This avoids repeating the same code multiple times, and as part of the changes we'll also utilize existing PDF.js helpers more.