JS Form File

Das Goravani goravanis at gmail.com
Sat Mar 25 15:25:29 UTC 2023

I did what I said I would try.. putting my download code back onto straight following the print function, not call it from $pdfcomplete but rather set a task variable in there to signify that it completed.. have a repeat loop back in the form waiting for that task var to say it’s completed, then break to end of loop and go on to download

This worked, sort of.

$pdfcomplete never got called, probably because I had a repeat loop going with the sleep command in it. I thought if I slept for half a second it would call $pdfcomplete in that space, but it doesn’t, I think I am "keeping Omnis busy" so that it doesn’t call it.

I put a max wait time of 10 seconds then I break to end and download, and that worked, so long as my pdf completes within 10 seconds.

Most pdfs would complete in that time.. one page pdfs, and even a few pages, would complete in that time. This particular routine could be sent a very large pdf however, and that may not finish in 10 seconds. 

I tried "test if file exists" to see if I could trap it’s completion that way, but I think $settemp creates the file fully at the outset, and then it gets filled with pdf data.. but it’s always created.. because my loop said it was created even before the pdf was done. Bummer. 

So Omnis has not quite addressed 

Downloading a pdf of any size
From a remote form
And not wait needlessly for a long time

Because the FormFile object is your only means of download from a remote form
But it needs to wait for the pdf to be complete.. it is not complete when your code finishes printing.. even a simple one pager takes longer than that
$pdfcomplete is a good idea, but it blows away scope or something if you call back to your form
You have to call back to your form to download because you are using an object placed on the form
But currently it says "Notation not supported" if you do this.. call back to your form and try to download

More information about the omnisdev-en mailing list