Skip to main content
March 5, 2019
Answered

Silent printing in IE using activeX

  • March 5, 2019
  • 1 reply
  • 2285 views

Hello

I'm trying to pritn using adobe acrobat activeX

here is my code

<!DOCTYPE html>

<html>

<head>

    <title>Print Test</title>

    <meta charset="utf-8" />

    <script>

        function startPrinting() {

          

  

        var acrobatObj = document.createElement('object');

        acrobatObj.width = '500';

        acrobatObj.height = '500';

        acrobatObj.classid = 'clsid:CA8A9780-280D-11CF-A24D-444553540000';

document.body.appendChild(acrobatObj)

acrobatObj.src = 'test.pdf';

            window.setTimeout(

                function () {

                    acrobatObj.print();

                }, 1000);   // how big timeout?

        }

        window.onload = startPrinting;

    </script>

</head>

<body>

<div id="ext-gen289"></div>

</body>

</html>

It works nicelly

Now the question- if user has low bandwidth, the setTimeout to 1 second is not enough.

In fact soem of users need to wait 1 minute to donlload respective file. While the others on stronger network, can print normally withoin one second

Is there a wya how the activeX would notify me "i have whole content"

I tried to play with cache, cookies sent prom the server, buffered reponse or session with no luck so far

Thanks

Zdenek

This topic has been closed for replies.
Correct answer try67

What I mean is add the printing code to a doc-level function of the PDF, like this:

this.print();

That way, when the file is opened (in a viewer that supports scripts correctly), the print dialog will immediately appear.

1 reply

try67
Community Expert
Community Expert
March 7, 2019

Try embedding the code in the actual file, instead of doing it via the HTML page.

March 7, 2019

Hello

what you mean by "embedding the code in the actual file"
I need to print from browsers (our app is in the browser, above is simplifed example)

How would that explain that it works in FF/Chrome and not in IE?

Thanks

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 7, 2019

What I mean is add the printing code to a doc-level function of the PDF, like this:

this.print();

That way, when the file is opened (in a viewer that supports scripts correctly), the print dialog will immediately appear.