pdf generation takes time

Geert Geert at royalbotania.com
Tue May 6 09:59:39 UTC 2025


It's not quite clear to me how to implement $pdfcomplete

Found it in the remote task
Do I need to override the method in the remote task and use $showmessage to show (f.i. the pPath) on success ? And end with Do inherited ?
How to pick up the received $pdfcomplete event and do something with it?

When showing the pdf (during development)
And only then press the button "Show pdf" on the remote form ?

When uploading the pdf (once it all works)
And upload the PDF file from its temp locations to an online storage location ?

Kind regards,
Geert
________________________________
From: omnisdev-en on behalf of Rob Mostyn
Sent: Sunday, May 04, 2025 18:30
To: OmnisDev List - English
Subject: Re: pdf generation takes time

Hi Geert,

Have you considered “farming this off” to pdf worker and using the $pdfcomplete method  to send a message back to your task?  When this happens the pdf has indeed completed and ready for your next step.  No loops.

Rob Mostyn

> On 4 May 2025, at 16:46, Geert <Geert at royalbotania.com> wrote:
>
> Hello,
>
> I'm generating a product sheet from a js form by requesting several data in an object from a REST api (pictures, text, url's, picture for every possible colour up to 20,...)
> Using a report class printing to O$11 PDF device (Windows 11)
> After the  (4MB to 10MB) file is generated (it takes a few seconds) I show the pdf in another tab page in the browser. (or in the future maybe return a REST response or upload the file to an assets library).
>
> The problem : things go too fast in Omnis Studio.  The pdf file is not yet created or still open when I want to show the pdf.
> This can be monitored when issuing Do $devices.PDF.$setparam(kDevOmnisPDFParamKeepScriptAndPNGs,kTrue)
>
> The reason : the PDF file is created by Node.js (which is built-in into Omnis).  Omnis generates the .js file plus the PNGs and Node.js executes the .js file to generate the PDF.  So Omnis code continues while node.js is still writing to the pdf file.
>
> The possible solution : adding a loop to wait a second, use FileOps to test existence and after that use oFileOps to test if not open anymore.  This does not seem to work.  I still get an error message in the browser that the pdf file couldn't show.  Retrying a few times the pdf is shown anyway but that's not user friendly.
>
> Do you guys have another workaround to know when node.js is really finished ?
>
> Kind regards,
> Geert
>
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list