[Gambas-user] Empty PDF problem - maybe Cairo too slow?
Rolf-Werner Eilert
eilert-sprachen at ...221...
Fri Aug 16 09:13:44 CEST 2013
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
More information about the User
mailing list