OK I have come back to this and found a solution that is a bit complex but seems to be really reliable, and follows standards to at least some extent.
Window instance variables:
Boolean ib_navigate_called // have we called navigate on the source file?
Boolean ib_navigate_started // has it really started navigating, after we called it?
Script to start navigation:
ib_navigate_called = FALSE
ib_navigate_started = FALSE
if wb_1.navigate(as_source) <> 1 then
// give error message
ib_navigate_called = TRUE // indicate we have tried to start navigating
WebBrowser control NavigationStart event:
// We need to know it has really started navigating before we try to determine whether it has finished
if ib_navigate_called then ib_navigate_started = TRUE
WebBrowser control NavigationProgressIndex event:
// Navigation has been started. If it indicates 100 percent finished, check the document.readyState.
// If that is "complete", print the PDF file.
if NOT ib_navigate_started then return
if progressindex < 100 then return
if Pos(lsRet, '"complete"') = 0 then
ib_navigate_started = FALSE // prevent recursion & thus doing any following steps twice
// now do whatever you need to do, it should be fully loaded!