Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:41:45+00:00 2026-06-14T14:41:45+00:00

I am trying to set a delay between the time the pdf is opened

  • 0

I am trying to set a delay between the time the pdf is opened and the print function is called on the pdf file. Currently nothing happens but if I move the print function outside of the setTimeout it will call the print function but this is not what I want because it is too quick and pdf has not been loaded. When I place alerts inside the setTimeout they are called fine with the specified 3 seconds.

var pdfWin = window.open(docPath);
setTimeout(function() {
   pdfWin.print();
},3000)

My question is: why is the print function not being called?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:41:45+00:00Added an answer on June 14, 2026 at 2:41 pm
    var pdfWin = window.open(docPath);
    pdfWin.onload = function() {
        pdfWin.print();
    };
    

    Works fine for me in chrome.

    Due to same-origin policy, you can only call .print() on the window if it resides on the same domain as the parent window. Otherwise I could just open up your facebook on my page and submit some forms there ;p

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to download file using FTP, and in between if connection terminates
(programming Android in Eclipse) I am trying to set up a delay in changing
I'm very new to Javascript, and I'm trying to set a delay on some
I'm trying to animate a set of elements simultaneously (almost, there's a small delay
I am trying to delay PHP execution until a cookie is set through JavaScript.
I'm trying to add a delay at the beginning of each set of animations.
Possible Duplicate: function in setInterval() executes without delay I am trying to use setTimeOut
I am trying to set a cookie with a delayed amount of time. I
So I have an empty div set to display:none called id=c1. I am trying
Im trying set the single table inheritance model type in a form. So i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.