File f = new File("D:/tools/test.pdf"); java.io.FileOutputStream fos = new java.io.FileOutputStream(f); OutputStream sos = System.out; File fz = new File("D:/tools/yahoo.htm"); java.io.FileInputStream fis = new java.io.FileInputStream(fz); InputStreamReader isr = new InputStreamReader( fis, "UTF-8" ); PD4ML html = new PD4ML(); html.setPageSize( new Dimension(450, 450) ); html.setPageInsets( new Insets(20, 50, 10, 10) ); html.setHtmlWidth( 750 ); html.enableImgSplit( false ); URL base = new URL( "file:D:/tools/" ); // alternatively base can be specified with <base href="..."> tag html.render( isr, fos, base );