0

単純な html ファイルを GIF に変換するために、Ubuntu ボックスに htlm2ps をインストールしました。私のhtmlファイルは次のようになります。

<!DOCTYPE html> 
    <html lang='en'> 
    <head>
        <meta charset="utf-8">
    </head>
    <body style="width: 120px; height: 90px" >
     <div>
         <div>Gas Prices</div>
         <div>Todays local Prices</div>
         <div>Low Price&nbsp; &nbsp; &nbsp; &nbsp; 1.29</div>
         <div>High Price&nbsp; &nbsp; &nbsp; &nbsp; 1.44</div>
     </div> 
    </body>
 </html>

そして、私は次のように変換を実行します:

convert -size 120x90 gas.html gas.gif

ただし、生成されるイメージのサイズは常に 612x712 です。PNG や JPG に変換する場合も同様です。

私が間違っていることはありますか?

4

1 に答える 1

0

The -size option in Imagemagick is ignored as the page size is determined by html2ps converting the HTML into PostScript. I believe you'll need to set the size of the page with CSS within the document. See @paper option under html2ps's documentation.

/* 
  Check your version of html2ps, as @paper my have been replace with @page selector
 */
@paper {
    width: 120px;
    height: 90px;
    /* Note: Units may need to be converted to `em' or `pt' */
}
于 2014-01-21T14:38:22.493 に答える