added pdf preview function