Web Workers are a Web standard technology that allows script processing to be executed in background threads. Wijmo's 2018 v3 release introduced Web Workers to improve the usability of apps while generating a PDF.
Processing a PDF without Web Workers
In the animation below, you'll see that we're saving 100,000 rows of a grid to a PDF in the conventional way. The main thread runs for a long time, and in the meantime, the UI freezes and we see the warning screen. To shorten the duration of the animation, this is played at 4x speed.
In this case, the user can't cancel the PDF generation process. In addition, as long as the UI is frozen, we can't change the state of the button or display any helpful information like the progress rate. The user can only wait for a long time, with no feedback—a dissatisfying user experience.
Improve the user experience with Web Workers
Web Workers solve these problems neatly. Here's a look at the same grid, this time with Web Workers:
The heavy processing still takes a long time, but users can cancel processing (thereby avoiding the warning screen). In addition, we can change the button state and display the progress rate, providing vital feedback to users.
Web Workers Sample
Let's look at the Web Workers operation with the sample below. Keep in mind that the app is saving 100,000 grid rows to a 3,500-page PDF—it's a large document with heavy processing. (I recommend running it on Chrome.)
Try Wijmo's Web Workers Download the latest version of Wijmo
Try Wijmo's Web Workers
Download the latest version of WijmoDownload Now!