You are viewing limited content. For full access, please sign in.

Question

Question

Way to change focus when printing from WebLink?

asked on July 3, 2019

Hello,

We have a client that is trying to print out PDF's from WebLink and is noticing a difference in print focus, when using "ctrl+p." The behavior of ctrl+p is different depending on what has focus in the window.  Initial focus is the header of the page not the actual document. (See screenshot.) If they hit ctrl+p, their print looks like two blank pages. If they click inside the document anywhere and then hit ctrl+p then it will present the actual document for printing. (See second screenshot.) 

Is there any way to change the autofocus when it first loads the document to actually focus the document rather than the header or toolbar?

1 Initial Focus.png
2 Actual Document.png
0 0

Replies

replied on July 9, 2019 Show version history

Hi Aharon,

In WebLink 10 or later, you can add a script to DocView.aspx that automatically sets focus to the PDF iframe (if it exists) on page load.

Within the <script> tag on that page, add the following:

$(document).ready(function () {
    // Try until iframe is found or 10 seconds have passed.
    var i = 1;
    function focusPdfLoop() { 
        setTimeout(function () {
            if ($('#pdfViewerIFrame').length > 0) {
                $('#pdfViewerIFrame').focus();
                return; // exit loop
            }
            i++;
            if (i < 20) {
                focusPdfLoop();
            }
        }, 500);
    }
    focusPdfLoop();
});

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.