Community Forum

ScriptX printing error from iframes

Profile Image 3 Posts 3 Karma
novi4ok123 posted this 10 January 2017

Hello!

I have free licensed ScriptX version 7, and I have iframes from which I want to print html page...

So, when I print first iframe all is working fine, then I print another frame, and also all is OK, but when I returned to first frame, and want to print it , I get an JS error 

Only one ScriptX object can be used per browser window.

 Here is my declaration:

<!-- MeadCo ScriptX -->

<object id="factory" style="display:none"

 classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"

 codebase="/smsx.cab#Version=7">

</object> 

and printing code:

factory.printing.header = \"\";

factory.printing.footer = \"\";

factory.printing.portrait = true;

factory.printing.leftMargin = 0;

factory.printing.topMargin = 0;

factory.printing.rightMargin = 0;

factory.printing.bottomMargin = 0;

factory.printing.Print(false);

 

P.S in each frame page I have this code...

So any advices, please?

Post Edited 10 January 2017

Profile Image 189 Posts 189 Karma
Jerry posted this 10 January 2017

>> So any advices, please? <<

 

Yes. Script a *single* copy of the ScriptX object on the topmost page (i.e. the host of all th frames) and then call it there on 'top'. That way it is always available and instantiated, and you only have ony copy.

top.factory.printing.header = \"\";

 

etc.

 

Profile Image 3 Posts 3 Karma
novi4ok123 posted this 11 January 2017

and object declaration 

 <object id="factory" style="display:none"

 classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"

 codebase="/smsx.cab#Version=7">

</object>

also in host frames file

Post Edited 11 January 2017

Profile Image 189 Posts 189 Karma
Jerry posted this 11 January 2017

>> also in host frames file <<

 

Well, good!  So use ONLY that instance, pointing at it on 'top' from all of your framed content.

 

top.factory.printing.header = \"\";

 

etc

Post Edited 11 January 2017

Profile Image 3 Posts 3 Karma
novi4ok123 posted this 11 January 2017

it doesnot helps....

Profile Image 189 Posts 189 Karma
Jerry posted this 11 January 2017

>> it doesnot helps.... <<

 

That is the right way to deploy ScriptX on a framed page, so use it please.

 

You may also need to call a timeout after your call to Print and before page navigate or browser cloise to allow the print job time to spool.

 

That's it ... 'free' ScriptX is not entitled to support, so now it is down to your own experimentation.

 

Jerry