added pdf functionality partially