Vi riporto questa discussione apparsa nella M.L.I.:
" I have been trying around this problem and found a reproduceable behaviour.
To make it short, this is the standard way in my program:
Within SUB Main, I read the mails from the server (contact forms), one
by one. Each one's data is processed into a pdf (pdf made by Cairo
class) and a mail text body, then sent to the recipient by e-mail via
the external script (shelling out).
When the whole thing runs from cron, it will deliver 0 Byte PDFs, but
the originals on the system are fine (the copies remain in the
directory). The mailing system does not see any error.
Now is the trick: When I use a ready-made pdf copy and call mail-sending
SUB with these data directly, it will deliver the PDF correctly. This is reproduceable.
So my thought was, it might be that when started from cron, the Gambas
app runs through so fast that it calls mail sending BEFORE Cairo is
ready writing the PDF. This would mean Cairo is working on its own. So
there is a file (you have to give the file name before starting to
print), but 0 bytes, and that is sent. Only after sending the mail, the
rest of the data is written and remains in the directory.
How could I check for Cairo to be done with the file before sending the
mail? Or should I just wait couple of seconds?
Rolf "
" AFAIK, Cairo is synchronous, so when Cairo.End() returns, your PDF file
should be complete. Show us some code...
--
Benoît Minisini "
" Problems with cron usually result from missing pathes. Cron does not
starts a shell with its enviroment. So you have to use absolut paths to
your programm(s) and perhap setup environment variable if needed.
Hope thät helps
Rolf "