1
votes

I have a PowerBuilder app that creates informs and save then as PDF with PDFCreator. After that, I want to send those files by mail, using an stored procedure in SQL server 2008.

For example, I have 50 informs. I want to: - Save all to pdf (50 pdf files - PowerBuilder app) - Send them by mail (stored procedure - SQL)

I save every inform with a DataWindow (.saveAs method): dw_1.saveAs(ls_path, PDF!, true)

If I try to run the app and, after that, run the stored procedure, the saving-to-pdf-process is much slower than the execution time of the app, so I cannot send the files by mail, because they have not been created yet... :(

What can I do? Any ideas?

Thx a lot

2

2 Answers

1
votes

Caveat: Haven't tried this myself.

I would expect that if you tried to FileOpen() the created PDF with LockReadWrite!, it would fail if the PDF creation process hadn't finished. So, I would try a loop with a Sleep() in it, exiting when the FileOpen() had succeeded. (Remember to FileClose() on success!) Call the stored proc after the loop exits.

Good luck,

Terry.

0
votes

We use the DataWindow saveas PDF (Ghostscript) which does not return until the PDF is created.