Forum How do I...?

wait a page to finished loading before rendering?

cyyeap
Hi all,

We're currently using wkhtmltopdf as a pdf to html tool. Our front end page is using Angular 5. I've attached the document we tried to generate using PrinceXML, it stucks at "Loading page".

Does PrinceXML has similar option like wkhtmltopdf --window-status to wait until a page has finished loading?

Could you please also provide an example how it should work? The closest function we think we can utilise is addScript but we aren't sure.

We've looked around this forum, but couldn't find any workaround for this situation. Do you have any suggestion?

Thanks
  1. try.pdf15.0 kB
    loading
mikeday
Prince may not support all the DOM interfaces needed to run AngularJS, are you seeing any error or warning messages in the Prince output log?
cyyeap
Hi Mikeday,

My question is that is there a way to tell PrinceXML to wait until a page is fully loaded?

There's no error/messages in the Prinec output log.

Thanks
mikeday
Prince doesn't run JavaScript asynchronously, so it always waits until everything has loaded and all scripts have finished executing. I suspect in this case the script isn't executing at all, perhaps because it depends on an event or feature we don't support yet.
cyyeap
Hi Mikeday

Thanks for your prompt reply.

The page is loaded at the time, but the page is still waiting for data to be retrieved completely. Once it's completed, the page will further emit a custom window_status to tell it's been *fully* loaded.

wkhtmltopdf currently supports this by:
--window-status <windowStatus> Wait until window.status is equal to this
string before rendering page

I wonder when Prince will incorporate this feature?

Thanks again
mikeday
Prince doesn't support asynchronous AJAX requests yet, nor the window.status field.
hallvord
Hi cyyeap, I'd like to investigate this problem a bit for you - do you have the document you try to render publicly available? Or perhaps you can reproduce the problem using some public Angular demo? Thanks :)

Announcement: repos for tests/utils