DWF Viewer (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WaitForPageLoaded fails

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
447 Views, 11 Replies

WaitForPageLoaded fails

No matter how I use it, in a function or inline (HTML, IE 5.5), WaitForPageLoaded API call fails with a "Object doesn't support this property or method" error.

Using exact syntax from API helpfile.

Any ideas?
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

The following code from the API help works fine for
me:

<script language="vbscript">

 function HideToolbar

    call
AdView.Viewer.WaitForPageLoaded()

    AdView.Viewer.ToolbarVisible =
false

  end function

</script>

<html>

  <body>

    <object id = "AdView"

       classid =
"clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"

        border =
1>

      <param
name="Src"  value="C:\M.dwf">

     
</object>

    <br>

    <br>

    <a
href="vbscript:HideToolbar">

      Hide the
Toolbar

    </a>

  </body>

</html>

Cheers,

Thilak

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5), WaitForPageLoaded
API call fails with a "Object doesn't support this property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 3 of 12
Anonymous
in reply to: Anonymous

Code example?

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5), WaitForPageLoaded
API call fails with a "Object doesn't support this property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 4 of 12
Anonymous
in reply to: Anonymous

Your code works because, as you code outlines,
the page is already loaded when you are selecting your hyperlink to turn the
toolbar off.  Try commenting out the hyperlink and adding this
instead:

 

<script language="vbscript">

   HideToolbar

</script>

 

You'll note that a realtime call to
WaitForPageLoaded() to poll if AdView.Viewer is done loading
won't work and will yield the error cited by the poster.

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

The following code from the API help works fine
for me:

<script language="vbscript">

 function HideToolbar

    call
AdView.Viewer.WaitForPageLoaded()

    AdView.Viewer.ToolbarVisible =
false

  end function

</script>

<html>

  <body>

    <object id = "AdView"

       classid =
"clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"

        border
= 1>

      <param
name="Src"  value="C:\M.dwf">

     
</object>

    <br>

    <br>

    <a
href="vbscript:HideToolbar">

      Hide the
Toolbar

    </a>

  </body>

</html>

Cheers,

Thilak

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5),
WaitForPageLoaded API call fails with a "Object doesn't support this
property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 5 of 12
Anonymous
in reply to: Anonymous


If you're trying to use the
WaitForPageLoaded() method inline somewhere after the OBJECT tag, then it
won't work.  I don't know if there's anything that Autodesk can do about
this as an inline call of this type is attempting to call a method of
AdView.Viewer, but it isn't completely loaded, so the method isn't
recognized.  Perhaps Autodesk could make it so that this
method is the *very first* thing to load so that, maybe, this method
might be available for use be scripting when called inline.  I think this
method is even more important than the SRC parameter, as you can set the SRC
drawing at any time in a variety of ways... but you need to know if the OBJECT
is loading when attempting to do anything inline.

 

Needless to say, I've had problems using this
method as well.  As far as I'm concerned, it's worthless.  The
WaitForPageLoaded() method is only recognized (and works) if the
page is completely loaded, control included, which completely invalidates
the premise of the method.

 

I've found workarounds if anyone is interested, but
it's still annoying.  Hopefully this will be addressed in the next
version.

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5), WaitForPageLoaded
API call fails with a "Object doesn't support this property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 6 of 12
Anonymous
in reply to: Anonymous

The WaitForPageLoaded() method is intended to work
with the src parameter in loading a multipage dwf file. It has nothing to do
with trying to wait for the html page to be loaded. The main intention of this
method is so that other API calls into the viewer to get information such as
layers collection or etc... will be wrong (as it is multi-threaded) if
called before the DWF page is completely loaded. This allows users to know when
the page is completely loaded so that the API calls return the right
information.

 

I will make a note to get this cleared up in the
documentation.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


If you're trying to use the
WaitForPageLoaded() method inline somewhere after the OBJECT tag, then it
won't work.  I don't know if there's anything that Autodesk can do about
this as an inline call of this type is attempting to call a method of
AdView.Viewer, but it isn't completely loaded, so the method isn't
recognized.  Perhaps Autodesk could make it so that this
method is the *very first* thing to load so that, maybe, this method
might be available for use be scripting when called inline.  I think this
method is even more important than the SRC parameter, as you can set the SRC
drawing at any time in a variety of ways... but you need to know if the OBJECT
is loading when attempting to do anything inline.

 

Needless to say, I've had problems using this
method as well.  As far as I'm concerned, it's worthless.  The
WaitForPageLoaded() method is only recognized (and works) if the
page is completely loaded, control included, which completely invalidates
the premise of the method.

 

I've found workarounds if anyone is interested,
but it's still annoying.  Hopefully this will be addressed in the next
version.

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5),
WaitForPageLoaded API call fails with a "Object doesn't support this
property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 7 of 12
Anonymous
in reply to: Anonymous

OK, moved WaitForPageLoaded to the Object statement, where it no longer bitches, but also appears to do nothing.

FITTOWINDOW, which is why I want WaitForPageLoaded to work, still has no effect unless I create a link to a function that uses it and click it after the page is up. I was hoping WaitForPageLoaded would hold off execution so FITOWINDOW would work in inline HTML.

I want the .DWF to be sized to the window extents showing paper size/margins AUTOMATICALLY when it loads, just as if the "Fit To Window" button on the Toolbar had been clicked. I don't care if it loads too big, and then has to be auto-resized after the initial load.

I realize that if I open another window with the target .DWF in it, it'll resize automatically, but I do NOT want to do this as the end user will wind up with a load of open windows if he doesn't close them one at a time after he's done with each.

Thie seems to me to be something everyone would want-why doesn't it work in inline HTML?
Message 8 of 12
Anonymous
in reply to: Anonymous

Subu:

 

Thanks for clearing up the intent of the
function.  So, if I understand correctly, the WaitForPageLoaded() method
should be available at *any time* during load to let the caller (perhaps
JavaScript or VBScript) know that the *DWF* is loaded.   This makes
sense.

 

The problem is, that WaitForPageLoaded() cannot be
called until the OBJECT and its DWF source are loaded completely.  So the
following won't work as it returns an error that say that the method or porperty
does not exist:

 


<html>
<head>
<script
language="javascript" type="text/javascript">
    function
foo() {
        // wait for page
load
       
AdView.Viewer.WaitForPageLoaded();

 

       
// set the values
    AdView.Viewer.ToolbarVisible =
false;
   
}
</script>
</head>
<body>
<object id="AdView"

 classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" border="0" 

 codebase="
href="http://www.autodesk.com/global/expressviewer/installer/ExpressViewerSetup.cab">http://www.aut...
">
   <param
name="Src"
value="http://SERVER_OR_IP/SomeDir/MyFile.dwf">
</object>
<br
/>
<!--
    Call the function "foo" during load to
dynamically set the viewer properties
-->

<script language="javascript"
type="text/javascript">

    foo();


size=2></script>
</body>
</html>

face=Arial>

Doesn't this mean that the method is only
useful to avoid collisions via function calls after
load?   This is the only way that it seems to
work:

 


<html>
<head>
<script
language="javascript" type="text/javascript">
    function
foo() {
        // wait for page
load
       
AdView.Viewer.WaitForPageLoaded();

 

       
// set the values
    AdView.Viewer.ToolbarVisible =
false;
   
}
</script>
</head>
<body>
<object id="AdView"

 classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" border="0" 

 codebase="
href="http://www.autodesk.com/global/expressviewer/installer/ExpressViewerSetup.cab">http://www.aut...
">
   <param
name="Src"
value="http://SERVER_OR_IP/SomeDir/MyFile.dwf">
</object>
<br
/>
<!--
    Call the function "foo" via user
selection *AFTER* DWF completely loaded
-->
<a
href="javascript:foo();">Click this link to turn off
toolbar</a>
</body>
</html>

TIA,

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

The WaitForPageLoaded() method is intended to
work with the src parameter in loading a multipage dwf file. It has nothing to
do with trying to wait for the html page to be loaded. The main intention of
this method is so that other API calls into the viewer to get information such
as layers collection or etc... will be wrong (as it is multi-threaded) if
called before the DWF page is completely loaded. This allows users to know
when the page is completely loaded so that the API calls return the right
information.

 

I will make a note to get this cleared up in the
documentation.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


If you're trying to use the
WaitForPageLoaded() method inline somewhere after the OBJECT tag, then
it won't work.  I don't know if there's anything that Autodesk can do
about this as an inline call of this type is attempting to call a method of
AdView.Viewer, but it isn't completely loaded, so the method isn't
recognized.  Perhaps Autodesk could make it so that this
method is the *very first* thing to load so that, maybe, this
method might be available for use be scripting when called inline.  I
think this method is even more important than the SRC parameter, as you can
set the SRC drawing at any time in a variety of ways... but you need to know
if the OBJECT is loading when attempting to do anything inline.

 

Needless to say, I've had problems using this
method as well.  As far as I'm concerned, it's
worthless.  The WaitForPageLoaded() method is only recognized
(and works) if the page is completely loaded, control included, which
completely invalidates the premise of the method.

 

I've found workarounds if anyone is interested,
but it's still annoying.  Hopefully this will be addressed in the next
version.

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5),
WaitForPageLoaded API call fails with a "Object doesn't support this
property or method" error.

Using exact syntax from API helpfile.

Any ideas?

Message 9 of 12
Anonymous
in reply to: Anonymous



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">I don’t think the order of
events is clear. When an HTML page is loaded this is the order



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">IE does
things.



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">

 




  1. style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">
    style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">The HTML is
    parsed.



  2. style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">
    style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">The AEV control is
    partially crated by IE.



  3. style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">
    style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Java and VB script that is
    not in user events is run. (the Java script in the code you posted fits in
    this category).



  4. style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">
    style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">The AEV control full
    loaded by IE and a page starts streaming.



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">

 



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">It is not possible for IE to
wait on step 3 for something that does not even start until step 4. IE would
never get to step 4 and the page would never s
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">tart
streaming
.



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">

 



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">The following is an example
of how and why someone might use WaitForPageLoaded().



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
 



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><object
classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"
   
id="AdView"
    width="450"
   
height="300">



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">    <param
name="Src"  value="
href="http://www.autodesk.com/file.dwf">http://www.autodesk.com/file.dwf
">
   
<param name="ToolbarVisible" value="0">   



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></object>



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
 



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><p> <INPUT
TYPE="button" VALUE="Show All Layers" onClick='ShowAllLayers()'>



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></p>



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
 



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SCRIPT
LANGUAGE="javascript">
    function ShowAllLayers()

    {
     
AdView.Viewer.WaitForPageLoaded();
     
ShowLayersOneAtATime ();
    }



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">    function
ShowLayersOneAtATime ()
   
{
        // First turn off all the
layers
        for (i = 1; i <=
AdView.Viewer.Layers.Count; i++ )

         
AdView.Viewer.Layers.Item(i).Visible = false;



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">       
// Now loop through the laysers showing one at a time

        for (i = 1; i <=
AdView.Viewer.Layers.Count; i++ )
       
{
           layer =
AdView.Viewer.Layers.Item(i);
          
layer.Visible =
true;
          
alert(layer.name);  

           layer.Visible =
false;
       }



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">       
// First turn all the layers back
on
        for (i = 1; i <=
AdView.Viewer.Layers.Count; i++ )

         
AdView.Viewer.Layers.Item(i).Visible = true;
   
}
    



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SCRIPT>



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Subu:

 

Thanks for clearing up the intent of the
function.  So, if I understand correctly, the WaitForPageLoaded() method
should be available at *any time* during load to let the caller (perhaps
JavaScript or VBScript) know that the *DWF* is loaded.   This makes
sense.

 

The problem is, that WaitForPageLoaded() cannot
be called until the OBJECT and its DWF source are loaded completely.  So
the following won't work as it returns an error that say that the method or
porperty does not exist:

 



size=2><html>
<head>
<script language="javascript"
type="text/javascript">
    function foo()
{
        // wait for page
load
       
AdView.Viewer.WaitForPageLoaded();

 


size=2>        // set the
values
    AdView.Viewer.ToolbarVisible =
false;
   
}
</script>
</head>
<body>
<object
id="AdView"
 classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"
border="0" 
 codebase="
href="http://www.autodesk.com/global/expressviewer/installer/ExpressViewerSetup.cab">http://www.a...
">
   <param
name="Src"
value="http://SERVER_OR_IP/SomeDir/MyFile.dwf">
</object>
<br
/>
<!--
    Call the function "foo" during load to
dynamically set the viewer properties
-->

<script language="javascript"
type="text/javascript">

    foo();


size=2></script>
</body>
</html>

face=Arial>

Doesn't this mean that the method is only
useful to avoid collisions via function calls after
load?   This is the only way that it seems to
work:

 



size=2><html>
<head>
<script language="javascript"
type="text/javascript">
    function foo()
{
        // wait for page
load
       
AdView.Viewer.WaitForPageLoaded();

 


size=2>        // set the
values
    AdView.Viewer.ToolbarVisible =
false;
   
}
</script>
</head>
<body>
<object
id="AdView"
 classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF"
border="0" 
 codebase="
href="http://www.autodesk.com/global/expressviewer/installer/ExpressViewerSetup.cab">http://www.a...
">
   <param
name="Src"
value="http://SERVER_OR_IP/SomeDir/MyFile.dwf">
</object>
<br
/>
<!--
    Call the function "foo" via user
selection *AFTER* DWF completely loaded
-->
<a
href="javascript:foo();">Click this link to turn off
toolbar</a>
</body>
</html>

TIA,

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

The WaitForPageLoaded() method is intended to
work with the src parameter in loading a multipage dwf file. It has nothing
to do with trying to wait for the html page to be loaded. The main intention
of this method is so that other API calls into the viewer to get information
such as layers collection or etc... will be wrong (as it is
multi-threaded) if called before the DWF page is completely loaded.
This allows users to know when the page is completely loaded so that the API
calls return the right information.

 

I will make a note to get this cleared up in
the documentation.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


If you're trying to use the
WaitForPageLoaded() method inline somewhere after the OBJECT tag,
then it won't work.  I don't know if there's anything that Autodesk
can do about this as an inline call of this type is attempting to call a
method of AdView.Viewer, but it isn't completely loaded, so the method
isn't recognized.  Perhaps Autodesk could make it so that this
method is the *very first* thing to load so that, maybe, this
method might be available for use be scripting when called inline.  I
think this method is even more important than the SRC parameter, as you
can set the SRC drawing at any time in a variety of ways... but you need
to know if the OBJECT is loading when attempting to do anything
inline.

 

Needless to say, I've had problems using this
method as well.  As far as I'm concerned, it's
worthless.  The WaitForPageLoaded() method is only
recognized (and works) if the page is completely loaded, control
included, which completely invalidates the premise of the
method.

 

I've found workarounds if anyone is
interested, but it's still annoying.  Hopefully this will be
addressed in the next version.

 

😛


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
No
matter how I use it, in a function or inline (HTML, IE 5.5),
WaitForPageLoaded API call fails with a "Object doesn't support this
property or method" error.

Using exact syntax from API helpfile.

Any
ideas?

Message 10 of 12
Anonymous
in reply to: Anonymous



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">You should be able to set
the view before the page has started streaming.
style="mso-spacerun: yes"> 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
OK,
moved WaitForPageLoaded to the Object statement, where it no longer bitches,
but also appears to do nothing.

FITTOWINDOW, which is why I want WaitForPageLoaded to work, still has no
effect unless I create a link to a function that uses it and click it after
the page is up. I was hoping WaitForPageLoaded would hold off execution so
FITOWINDOW would work in inline HTML.

I want the .DWF to be sized to the window extents showing paper
size/margins AUTOMATICALLY when it loads, just as if the "Fit To Window"
button on the Toolbar had been clicked. I don't care if it loads too big, and
then has to be auto-resized after the initial load.

I realize that if I open another window with the target .DWF in it, it'll
resize automatically, but I do NOT want to do this as the end user will wind
up with a load of open windows if he doesn't close them one at a time after
he's done with each.

Thie seems to me to be something everyone would want-why doesn't it work in
inline HTML?

Message 11 of 12
Anonymous
in reply to: Anonymous

so HOW do I get FITTOWINDOW to do what it's supposed to do other than calling it as a function with an external link or control AFTER the .DWF is loaded?

Or is there some other way to make sure that the .DWF loads with paper extent shown?

Some option in the Plot to .DWF stuff, perhaps?
Message 12 of 12
Anonymous
in reply to: Anonymous


When the dwf loads it
displays the view named initial. All dwf files from AutoCAD have an initial
view. If you are publishing the dwf files you have control over the initial
view.


 


Or


 


You can add other named
views when publishing the dwf file. If you know the names of these views you can
set one of these views using the view param. You do not need to wait for the
stream to finish loading before setting a view.



style="MARGIN: 0in 0in 0pt 0.25in">

 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
so
HOW do I get FITTOWINDOW to do what it's supposed to do other than calling it
as a function with an external link or control AFTER the .DWF is loaded?

Or is there some other way to make sure that the .DWF loads with paper
extent shown?

Some option in the Plot to .DWF stuff,
perhaps?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report