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

Question

Question

delay pdf generation for javascript

asked on April 11, 2018 Show version history

I have a form that is a fixed number of rows pulled from the database, with a drop-down on every row that contain the same options. I have some javascript that runs after the form is submitted to pull out all the options that are not selected anywhere, and display them in a list below the grid. This works when viewing the submission, however it only partially completes when generating the list for creating a PDF. Is there some way to delay the completion of the PDF? Or for the pdf to not trigger until a specific event has fired? The javascript runs on $(document).ready.

 

EDIT: If it wasn't clear, I need the PDF to not generate until after javascript execution has completed.

0 0

Answer

SELECTED ANSWER
replied on April 12, 2018

Turns out there was a javascript error that wasn't being thrown by Chrome that was by the PDF generating script; the page worked fine in Chrome, but would stop partway through the javascript when creating the PDF.

0 0
replied on May 4, 2021 Show version history

How did you identify the error that was getting thrown during pdf creation? I think I'm running into the same problem.

0 0

Replies

replied on April 11, 2018 Show version history

You could use SetTimeout

$(document).ready(function() {
    setTimeout(function() {
         
      //Your code in here

    }, 4000);
});
0 1
replied on April 12, 2018

That does the opposite of what I'm looking for - I want to delay the creation of the PDF, since it does this before javascript finishes. setTimeout delays the javascript execution, so none of it gets completed before the PDF is run.

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

Sign in to reply to this post.