Your problem cannot be reproduced with recent versions of iText.
I used the following HTML file (lists.html
):
<body>
<div>
<ol start="4" style="list-style-type: decimal;">
<li>Element 1</li>
<li>Element 2</li>
<li>Element 2</li>
</ol>
</div>
</body>
Then I used the following Java code with iText 7.1.2 and pdfHTML 2.0.2.
import java.io.File;
import java.io.IOException;
import com.itextpdf.html2pdf.HtmlConverter;
public class Lists {
public static final String SRC = "src/main/resources/html/lists.html";
public static final String DEST = "target/results/lists.pdf";
public static void main(String[] args) throws IOException {
File file = new File("target/results/");
file.mkdirs();
new Lists().createPdf(SRC, DEST);
}
public void createPdf(String src, String dest) throws IOException {
HtmlConverter.convertToPdf(new File(src), new File(dest));
}
}
The resulting PDF (lists.pdf
) looks like this:

You indicate that you are using iText 2.1.7. That version dates from 2009 and the old HTMLWorker
functionality has been abandoned many years ago because it was broken beyond repair. Please consult the introduction of the official HTML to PDF tutorial for an overview of the history of HTML to PDF conversion with iText.