Among PD4ML examples
http://pd4ml.com/examples.zip there is
PD4MLBySslServlet.java class, which ilustrates how to use PD4ML in web scenarios (just ignore SSL stuff there).
At first glance your Java code seems to be correct. So I would suspect source HTML as a reason of blank PDFs. Do you really have opening
<html> tag at the end of your HTML code? Please try to remove it - it may confuse the HTML parser.