I'm using the HTMLWorker to parse an HTML input document.  The document uses 
percentage sizes for the columns.  The PDF output doesn't use these, it splits 
the columns equally.  I saw a previous post on this, but never saw a solution.  
Sample HTML is:

<html>
        <body>
                <div align="center">
                        <center>
                                <table border="0" width="95%" cellspacing="0" 
cellpadding="0">
                                       <tr>
                                           <td width="100%" align="left" 
valign="top" bgcolor="#D1DEE9"><font face="Arial, Geneva, sans-serif" size="4" 
color="#003366"><b>RISK/ELIGIBILITY</b></font></td>
                                       </tr>
                                </table>
                                <table border="0" width="95%" cellspacing="0" 
cellpadding="0">
                                       <tr>
                                           <td width="5%" align="left" 
valign="top"><b><font face="Times New Roman" size="3">   1</font></b></td>
                                           <td width="95%" valign="top"><font 
face="Times New Roman" size="3">The risk profile of this case meets Fannie 
Mae's guidelines. </font></td>
                                       </tr>
                                </table>
                        </center>
                </div>
        </body>
</html>

Sample processing code is:

import java.io.FileOutputStream;
import java.io.FileReader;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.html.simpleparser.HTMLWorker;
import com.lowagie.text.pdf.PdfWriter;

public class HTMLConverter {
    public static void main(String[] args) {
        Document doc = new Document(PageSize.A4, 20, 20, 20, 20);
        
        try {
            PdfWriter.getInstance(doc, new 
FileOutputStream("c:\\smallTest.pdf"));
            HTMLWorker worker = new HTMLWorker(doc);
            FileReader fr = new FileReader("c:\\smallTest.html");
            doc.open();
            worker.parse(fr);
            doc.close();
            System.out.println("done");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Any suggestions?

Don


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to