Using "complete" and "error" events for PDF creation