cleanup PDF generation procedure