Repository navigation
Refactor Loading of NutrientPDF SDK - #1374
Conversation
3ecfe3d to
073fad9
Compare
|
Setting this as ready for review as client said testing looks good. |
…pe and preloading worker for improved performance
| href="/styles/nutrient-toolbar.css" | ||
| /> | ||
| <link rel="icon" href="/images/jasper-favicon.svg" /> | ||
| <script |
There was a problem hiding this comment.
Make sure this doesn't mess anything up in the prod build - I recall there being issues with that when I first added Nutrient in.
There was a problem hiding this comment.
Oh I see! This branch has been in TEST for few days now and appears to be working fine. I appreciate the heads up and will do some additional tests once this goes to PROD.
073fad9 to
9fc3220
Compare
| props.strategy.generatePDF(processedData), | ||
| props.strategy.initialize?.(), | ||
| // Recommended to preload the worker for better performance. | ||
| nutrientViewer.preloadWorker(configuration), |
There was a problem hiding this comment.
This does make the Promise.all dependent on preloadWorker running without error.
could do something like this above the promise.all instead to avoid that:
const preload = nutrientViewer.preloadWorker(configuration);
void preload.catch((error) => {
console.warn('Nutrient worker preload failed:', error);
});
There was a problem hiding this comment.
Sounds good. Will update.
| }, | ||
| text: { | ||
| ...presets.text, | ||
| font: 'Calibri', |
There was a problem hiding this comment.
Is this working ok on our linux-based aws image? Calibri is common on windows but not unix-based systems. Might end up falling back to sans-serif.
There was a problem hiding this comment.
Yup, Longine and I were testing it and Calibri looks to be working fine.
|



A bug was raised by the client where changing the size of the Nutrient text annotation box "drags/re-expands" which makes adjusting it very hard. Upon investigation, JASPER is referencing a hard-coded Nutrient JS v1.6 which is very old. The issue was actually fixed in v1.9.1 release. This PR refactors how Nutrient PDF SDK viewer is loaded which was also introduced to make asset loading simpler.
This also updates the default values (e.g. font-size, font-family) when using the Text tool.
Since it is a huge version jump, I have asked the client to perform regression testing to ensure everything still works as expected.