#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2015
    Posts
    3
    Rep Power
    0

    Cold Fusion PDF Generation of Asynchronous HTML File


    I have a report that is generated through various JavaScript asynchronous requests. We are now required to produce a PDF, save it on the server and email that report to the user using Cold Fusion. When generating PDF, Cold Fusion makes an HTTP request for the page to be printed and waits for a 200 response.

    The problem is the 200 response is received before all the JavaScript async requests are fulfilled. Apart from rewriting the report page entirely in ColdFusion, any ideas as to how to accomplish this? That is, wait for all the async requests to be fulfilled prior to generating a PDF to be saved and emailed.

    Thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    62
    Rep Power
    11

    Pdf


    Originally Posted by vdiaz1130
    I have a report that is generated through various JavaScript asynchronous requests. We are now required to produce a PDF, save it on the server and email that report to the user using Cold Fusion. When generating PDF, Cold Fusion makes an HTTP request for the page to be printed and waits for a 200 response.

    The problem is the 200 response is received before all the JavaScript async requests are fulfilled. Apart from rewriting the report page entirely in ColdFusion, any ideas as to how to accomplish this? That is, wait for all the async requests to be fulfilled prior to generating a PDF to be saved and emailed.

    Thanks!
    Can you put coldfusion to sleep, then continue after a couple of seconds?
    Adobe ColdFusion 9 * Sleep
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2015
    Posts
    3
    Rep Power
    0
    Originally Posted by danarashad
    Can you put coldfusion to sleep, then continue after a couple of seconds?
    Adobe*ColdFusion*9 * Sleep
    That may be possible but the requests may take an unknown amount of time. That is, it can take 1 second for all requests to be fullfilled or it can take 60 seconds. So putting CF to sleep or simply setting a timer to execute after an allotted amount of time may not be reliable.

    Thoughts?

    Thanks!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    62
    Rep Power
    11

    pdf


    Originally Posted by vdiaz1130
    That may be possible but the requests may take an unknown amount of time. That is, it can take 1 second for all requests to be fullfilled or it can take 60 seconds. So putting CF to sleep or simply setting a timer to execute after an allotted amount of time may not be reliable.

    Thoughts?

    Thanks!
    A report that takes a minute to run. Could you run this report overnight and have it emailed to the user/users at night.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2015
    Posts
    3
    Rep Power
    0
    Originally Posted by danarashad
    A report that takes a minute to run. Could you run this report overnight and have it emailed to the user/users at night.
    Not really. I was stating that we don't know exactly how long the report would take to be generated. We rely on external services that vary in their response time. It usually takes less than 10 seconds to generate the report but there are those off situations where it may take longer.

    Running the report overnight would require us to rewrite everything in ColdFusion which we are trying to avoid as all the code is already written for it in JavaScript.
  10. #6
  11. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    971
    You could also set up the client to poll the CF server every 1000 ms or something, and once CF says its part is done, then the client can go on with its part of the process.

IMN logo majestic logo threadwatch logo seochat tools logo