PDF generation nearly completed yet error in text rendering