fns to read in and write out pdfs (hopefully)