improved pdf test error handling