fix bugs, support pdf, add option

fix message timeout problem.
add pdf server url option.
refactor code.