Final version of PDF script (before reviewing)