Class WaitFor


  • public class WaitFor
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      WaitFor()
      Default construct WaitFor object.
      WaitFor​(int maxWaitTime)
      Default construct WaitFor object.
      WaitFor​(int maxWaitTime, int renderDelay)
      Default construct WaitFor object.
      WaitFor​(WaitForType type, int maxWaitTime, int networkIdleDuration, int numAllowedInflight, int renderDelayDuration, String htmlElementQueryStr)
      Intended to be used internally as our API recommends user to use convenient methods e.g.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void AllFontsLoaded()
      This method proceeds rendering by waiting until all of its fonts have been loaded.
      void AllFontsLoaded​(int maxWaitTime)
      This method proceeds rendering by waiting until all of its fonts have been loaded.
      String getHtmlElementQueryStr()  
      int getNetworkIdleDuration()  
      int getNumAllowedInFlight()  
      int getRenderDelayDuration()  
      int getTimeout()  
      WaitForType getType()  
      void HtmlElementByClassName​(String classAttribName)
      This method proceeds rendering by waiting until it finds the HTML element whose the class name as of the specified one.
      void HtmlElementByClassName​(String classAttribName, int maxWaitTime)
      This method proceeds rendering by waiting until it finds the HTML element whose the class name as of the specified one.
      void HtmlElementById​(String id)
      This method proceeds rendering by waiting until it finds the HTML element that has the same id as specified one.
      void HtmlElementById​(String id, int maxWaitTime)
      This method proceeds rendering by waiting until it finds the HTML element that has the same id as specified one.
      void HtmlElementByName​(String name)
      This method proceeds rendering by waiting until it finds the element with the attribute name as of the specified one.
      void HtmlElementByName​(String name, int maxWaitTime)
      This method proceeds rendering by waiting until it finds the element with the attribute name as of the specified one.
      void HtmlElementByTagName​(String tagName)
      This method proceeds rendering by waiting until it finds the HTML element that itself has the same tag name as of specified one.
      void HtmlElementByTagName​(String tagName, int maxWaitTime)
      This method proceeds rendering by waiting until it finds the HTML element that itself has the same tag name as of specified one.
      void HtmlQuerySelector​(String htmlQueryStr)
      This method proceeds rendering by waiting until it finds the HTML element via the specified query string which is executed by a JavaScript function document.querySelector().
      void HtmlQuerySelector​(String htmlQueryStr, int maxWaitTime)
      This method proceeds rendering by waiting until it finds the HTML element via the specified query string which is executed by a JavaScript function document.querySelector().
      void JavaScript()
      This method proceeds rendering by waiting until user calls IronPdf's internal JavaScript function window.ironpdf.notifyRender().
      void JavaScript​(int maxWaitTime)
      This method proceeds rendering by waiting until user calls IronPdf's internal JavaScript function window.ironpdf.notifyRender().
      void NetworkIdle​(int networkIdleDuration, int maxNumAllowedInflight)
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least specified networkIdleDuration as well as at maximum of maxNumAllowedInflight inflight (outstanding) network requests.
      void NetworkIdle​(int networkIdleDuration, int maxNumAllowedInflight, int maxWaitTime)
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least specified networkIdleDuration as well as at maximum of maxNumAllowedInflight inflight (outstanding) network requests.
      void NetworkIdle0()
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity.
      void NetworkIdle0​(int maxWaitTime)
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity.
      void NetworkIdle2()
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least 500ms as well as at maximum of 2 inflight (outstanding) network request.
      void NetworkIdle2​(int maxWaitTime)
      This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least 500ms as well as at maximum of 2 inflight (outstanding) network request.
      void PageLoad()
      Basically it waits for nothing, but will render as soon as the page loaded.
      void RenderDelay​(int delay)
      This method proceeds rendering by introducing an initial delay before rendering.
    • Field Detail

      • DefaultMaxWaitTime

        public static final int DefaultMaxWaitTime
        Default maximum wait time in milliseconds
        See Also:
        Constant Field Values
      • DefaultRenderDelayDuration

        public static final int DefaultRenderDelayDuration
        Default render delay duration in milliseconds.
        See Also:
        Constant Field Values
    • Constructor Detail

      • WaitFor

        public WaitFor​(int maxWaitTime)
        Default construct WaitFor object. Convenient method to construct a WaitFor object with default values.
        Parameters:
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
      • WaitFor

        public WaitFor()
        Default construct WaitFor object. Convenient method to construct a WaitFor object with default values.
      • WaitFor

        public WaitFor​(int maxWaitTime,
                       int renderDelay)
        Default construct WaitFor object. Convenient method to construct a WaitFor object with default values.
        Parameters:
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
        renderDelay - Render delay in milliseconds. It will delay before rendering. Default value is DefaultRenderDelayDuration This will set to RenderDelay(int).
      • WaitFor

        public WaitFor​(WaitForType type,
                       int maxWaitTime,
                       int networkIdleDuration,
                       int numAllowedInflight,
                       int renderDelayDuration,
                       String htmlElementQueryStr)
        Intended to be used internally as our API recommends user to use convenient methods e.g. JavaScript(int), NetworkIdle0(int) and others to construct the WaitFor object instead of manually setting each data fields. We use this internally as part of parsing ProtoBuf structure.
        Parameters:
        type - WaitFor type
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering.
        networkIdleDuration - Network idle duration to be regarded as network idle event.
        numAllowedInflight - Number of inflight network request allowed to have while still regarded it as network idle event.
        renderDelayDuration - Amount of time to delay before rendering (in ms)
        htmlElementQueryStr - HTML element query string that will be passed to JavaScript's document#querySelector().
    • Method Detail

      • getTimeout

        public final int getTimeout()
      • getNetworkIdleDuration

        public final int getNetworkIdleDuration()
      • getNumAllowedInFlight

        public final int getNumAllowedInFlight()
      • getRenderDelayDuration

        public final int getRenderDelayDuration()
      • getHtmlElementQueryStr

        public final String getHtmlElementQueryStr()
      • PageLoad

        public final void PageLoad()
        Basically it waits for nothing, but will render as soon as the page loaded.

        There is no need to call this method if user desires to normally render the page. It is mostly useful to reset WaitFor configurations back to wait for nothing.

        Page loaded in this case means only loaded in DOM, not the resource loaded.
      • RenderDelay

        public final void RenderDelay​(int delay)
        This method proceeds rendering by introducing an initial delay before rendering.
        Parameters:
        delay - Delay time in milliseconds before rendering
      • JavaScript

        public final void JavaScript()
        This method proceeds rendering by waiting until user calls IronPdf's internal JavaScript function window.ironpdf.notifyRender().
      • JavaScript

        public final void JavaScript​(int maxWaitTime)
        This method proceeds rendering by waiting until user calls IronPdf's internal JavaScript function window.ironpdf.notifyRender().
        Parameters:
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
      • NetworkIdle0

        public final void NetworkIdle0()
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity. after at least 500ms as well as no inflight (outstanding) network requests.
      • NetworkIdle0

        public final void NetworkIdle0​(int maxWaitTime)
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity. after at least 500ms as well as no inflight (outstanding) network requests.
        Parameters:
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
      • NetworkIdle2

        public final void NetworkIdle2()
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least 500ms as well as at maximum of 2 inflight (outstanding) network request.
      • NetworkIdle2

        public final void NetworkIdle2​(int maxWaitTime)
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least 500ms as well as at maximum of 2 inflight (outstanding) network request.
        Parameters:
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
      • NetworkIdle

        public final void NetworkIdle​(int networkIdleDuration,
                                      int maxNumAllowedInflight)
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least specified networkIdleDuration as well as at maximum of maxNumAllowedInflight inflight (outstanding) network requests.
        Parameters:
        networkIdleDuration - Duration of time in milliseconds to regard as network idle event
        maxNumAllowedInflight - Maximum number of allowed inflight network requests to not invalidate network idle event
      • NetworkIdle

        public final void NetworkIdle​(int networkIdleDuration,
                                      int maxNumAllowedInflight,
                                      int maxWaitTime)
        This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least specified networkIdleDuration as well as at maximum of maxNumAllowedInflight inflight (outstanding) network requests.
        Parameters:
        networkIdleDuration - Duration of time in milliseconds to regard as network idle event
        maxNumAllowedInflight - Maximum number of allowed inflight network requests to not invalidate network idle event
        maxWaitTime - Maximum wait time in milliseconds until it forces rendering. Default value is DefaultMaxWaitTime
      • HtmlQuerySelector

        public final void HtmlQuerySelector​(String htmlQueryStr)
        This method proceeds rendering by waiting until it finds the HTML element via the specified query string which is executed by a JavaScript function document.querySelector().

        Read querySelector() documentation.

        Parameters:
        htmlQueryStr - HTML element query string to query for with Javascript's document#querySelector()
      • HtmlQuerySelector

        public final void HtmlQuerySelector​(String htmlQueryStr,
                                            int maxWaitTime)
        This method proceeds rendering by waiting until it finds the HTML element via the specified query string which is executed by a JavaScript function document.querySelector().

        Read querySelector() documentation.

        Parameters:
        htmlQueryStr - HTML element query string to query for with Javascript's document#querySelector()
        maxWaitTime - Maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.
      • HtmlElementById

        public final void HtmlElementById​(String id)
        This method proceeds rendering by waiting until it finds the HTML element that has the same id as specified one.

        Related JavaScript API that works similarly to this method is getElementsByClassName() but instead it makes a query directly via `document.querySelector()` as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        id - Target element Id. Id token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        Throws:
        IronPdfInputException - Thrown if input id is invalid not according to HTML name and Id naming rule.
      • HtmlElementById

        public final void HtmlElementById​(String id,
                                          int maxWaitTime)
        This method proceeds rendering by waiting until it finds the HTML element that has the same id as specified one.

        Related JavaScript API that works similarly to this method is getElementsByClassName() but instead it makes a query directly via `document.querySelector()` as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        id - Target element Id. Id token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        maxWaitTime - Maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.
        Throws:
        IronPdfInputException - Thrown if input id is invalid not according to HTML name and Id naming rule.
      • HtmlElementByName

        public final void HtmlElementByName​(String name)
        This method proceeds rendering by waiting until it finds the element with the attribute name as of the specified one.

        Related JavaScript API that works similarly to this method is getElementsByName() but effective only for first found element from the result. Instead it makes a query directly via `document.querySelector()` as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        name - Target element name# Name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • HtmlElementByName

        public final void HtmlElementByName​(String name,
                                            int maxWaitTime)
        This method proceeds rendering by waiting until it finds the element with the attribute name as of the specified one.

        Related JavaScript API that works similarly to this method is getElementsByName() but effective only for first found element from the result. Instead it makes a query directly via `document.querySelector()` as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        name - Target element name# Name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        maxWaitTime - Maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • HtmlElementByTagName

        public final void HtmlElementByTagName​(String tagName)
        This method proceeds rendering by waiting until it finds the HTML element that itself has the same tag name as of specified one.

        Related JavaScript API that works similarly to this method is getElementsByTagName() but effective only for first found element from the result. Instead it makes a query directly via document.querySelector() as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        tagName - Target element's tag name# Tag name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • HtmlElementByTagName

        public final void HtmlElementByTagName​(String tagName,
                                               int maxWaitTime)
        This method proceeds rendering by waiting until it finds the HTML element that itself has the same tag name as of specified one.

        Related JavaScript API that works similarly to this method is getElementsByTagName() but effective only for first found element from the result. Instead it makes a query directly via document.querySelector() as it calls HtmlQuerySelector(String, int) internally.

        Parameters:
        tagName - Target element's tag name# Tag name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
        maxWaitTime - Maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • HtmlElementByClassName

        public final void HtmlElementByClassName​(String classAttribName)
        This method proceeds rendering by waiting until it finds the HTML element whose the class name as of the specified one.

        Related JavaScript API that works similarly to this method is getElementsByClassName() but effective only for first found element from the result. Instead it makes a query directly via document.querySelector() as it calls HtmlQuerySelector(String, int) )} internally.

        Parameters:
        classAttribName - Target element's class attribute name# Class attribute name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), and underscores ("_").
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • HtmlElementByClassName

        public final void HtmlElementByClassName​(String classAttribName,
                                                 int maxWaitTime)
        This method proceeds rendering by waiting until it finds the HTML element whose the class name as of the specified one.

        Related JavaScript API that works similarly to this method is getElementsByClassName() but effective only for first found element from the result. Instead it makes a query directly via document.querySelector() as it calls HtmlQuerySelector(String, int) )} internally.

        Parameters:
        classAttribName - Target element's class attribute name# Class attribute name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), and underscores ("_").
        maxWaitTime - Maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.
        Throws:
        IronPdfInputException - Thrown if input name is invalid not according to HTML name and Id naming rule.
      • AllFontsLoaded

        public final void AllFontsLoaded()
        This method proceeds rendering by waiting until all of its fonts have been loaded. Such font types can local, remote, or google web fonts.
      • AllFontsLoaded

        public final void AllFontsLoaded​(int maxWaitTime)
        This method proceeds rendering by waiting until all of its fonts have been loaded. Such font types can local, remote, or google web fonts.
        Parameters:
        maxWaitTime - maximum wait time (in ms) until it forces rendering. Default is DefaultMaxWaitTime.