mnater / Hyphenopoly

Hyphenation for node and Polyfill for client-side hyphenation.
http://mnater.github.io/Hyphenopoly/
MIT License
689 stars 45 forks source link

Callback when hyphenation is finished #192

Closed hathiphant closed 2 years ago

hathiphant commented 2 years ago

Your project is really useful (for Chromium headless in my use-case, using CDP). I have a question: is it possible in configuration to declare a custom JavaScript function which will be called when hyphenation will be done.

The reason is that randomly the generated PDF is blank (but with the good number of pages). I suspect the printing to PDF (via CDP) and the hyphenation are running concurrently giving this result and I would like to delay the printing to PDF, after the hyphenation will be finished but I need a notification of the end of hyphenation.

Thank you very much for your good project and your help.

mnater commented 2 years ago

Yes, there is: https://mnater.github.io/Hyphenopoly/Events.html#hyphenopolyend-event

hathiphant commented 2 years ago

By delaying the PDF generation to after the handling of the event, it worked perfectly. My problem of blank pages has now vanished. Your link to your documentation was a very useful information. Thank you very much.