Adjusted print to PDF function