Custom Fonts in HTML to PDF

To ensure the proper rendering of assets that require time to load, it is essential to specify a render delay using the waitFor class. This includes assets such as JavaScript, fonts, and network resources.

To render HTML content with a custom font from Google Fonts, configure the rendering options to use the waitFor property. Set the wait for type as RenderDelay and specify a maximum wait time of 500 milliseconds.

After rendering the HTML, export the PDF document. You can check the resulting PDF to see the custom font perfectly loaded and displayed.