improved pdf functionality