2

I'm trying to convert HTML to PDF using htmldoc, but even basic HTML does not convert properly, I have this HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>pdf test</title>
</head>

<body>
    <table border="1">
        <tr>
            <td width="50%">
                a
            </td>
            <td>
                <p>
                    some address
                </p>
                <p>
                    some other text
                </p>
            </td>
        </tr>
        <tr>
            <td>
                test<br>
                test2<br>
                asdfasdf<br>
                qwerqwer<br>
                fasdfasdf
            </td>
            <td>
                bla
            </td>
        </tr>
    </table>
</body>

</html>

but it renders like this: test.pdf using this command:

htmldoc --webpage --color --charset utf-8 -t pdf14 --size a4 test.html -f test.pdf

it's HTMLDOC Version 1.9svn, I tried to change charset, add thead, tbody etc and nothing helped .. do you know what can be the problem ?

also it doesn't accept style="padding: 10px" in that paragraphs etc

boobiq
  • 2,984
  • 2
  • 20
  • 27
  • Bump. Same problem. 1.9 doesn't appear to ever have been finished and 1.8 doesn't support utf8. The easy solution is to use another pdf library. Unfortunately, my client is the government and they're forcing me to use this. Strategies for utf8 encoding for version 1.8, or fix for 1.9 not displaying in FF/IE needed. – Nick Hagianis Feb 27 '12 at 23:32
  • 1
    Your test.pdf URL pointing to domain pocebo.sk is unresolvable, for me at least. – Mörre Dec 17 '14 at 12:19

1 Answers1

1

The command:

htmldoc --size universal --webpage -t pdf --firstpage p1 -f test.pdf test.html

renders the page well for me. It is unclear from the original question whether the options for utf-8 color and pdf type you entered are actually needed for your result or are actually the cause of the incorrect rendering.

Mörre
  • 5,699
  • 6
  • 38
  • 63
shadowv
  • 11
  • 1