updated save pdf and png methods