Add target parameter support to write_pdf()