0

On my Ubuntu box I have installed htlm2ps in order to convert a simple html file to a GIF. My html file looks like this:

<!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>

and I run convert like this:

convert -size 120x90 gas.html gas.gif

However, the generated image is always of size 612x712. Same thing when converting to PNG or JPG.

Any ideas what I'm doing wrong?

bardu
  • 727
  • 2
  • 8
  • 24

1 Answers1

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' */
}
emcconville
  • 23,800
  • 4
  • 50
  • 66
  • Thanks for you suggestions, however, neither '@paper' nor '@page' nor all unit variants solved the issue.I notice a message when executing convert: "Use of assignment to $[ is deprecated at /usr/bin/html2ps line 3409." I'm not familiar with Perl so I don't know whether this has something to do with size. BTW, I have html2ps version 1.0 beta7. – bardu Jan 21 '14 at 15:58