jarrekk / imgkit

🌁 Wkhtmltoimage python wrapper to convert HTML to image
MIT License
808 stars 73 forks source link

OSError: wkhtmltoimage exited with non-zero code 1. error: Unknown long argument --orientation #38

Open Taukurade opened 4 years ago

Taukurade commented 4 years ago

Im using code from example

body = """
<html>
  <head>
    <meta name="imgkit-format" content="png"/>
    <meta name="imgkit-orientation" content="Landscape"/>
  </head>
  Hello World!
  </html>
"""
    imgkit.from_string(body,'name.jpg')

and i get error:

OSError: wkhtmltoimage exited with non-zero code 1. error:
Unknown long argument --orientation

Name:
  wkhtmltoimage 0.12.5 (with patched qt)

Synopsis:
  wkhtmltoimage [OPTIONS]... <input file> <output file>

Description:
  Converts an HTML page into an image,

General Options:
      --crop-h <int>                  Set height for cropping
      --crop-w <int>                  Set width for cropping
      --crop-x <int>                  Set x coordinate for cropping
      --crop-y <int>                  Set y coordinate for cropping
  -H, --extended-help                 Display more extensive help, detailing
                                  less common command switches
  -f, --format <format>               Output file format (default png)
      --height <int>                  Set screen height (default is calculated
                                    from page content) (default 0)
  -h, --help                          Display help
      --license                       Output license information and exit
      --log-level <level>             Set log level to: none, error, warn or
                                  info (default info)
      --quality <int>                 Output image quality (between 0 and 100)
                                    (default 94)
  -q, --quiet                         Be less verbose, maintained for backwards
                                     compatibility; Same as using --log-level
                                   none
  -V, --version                       Output version information and exit
      --width <int>                   Set screen width, note that this is used
                                    only as a guide line. Use
                   --disable-smart-width to make it strict.
                 (default 1024)
Contact:
  If you experience bugs or want to request new features please visit
  <https://github.com/wkhtmltopdf/wkhtmltopdf/issues>
gil-opplane commented 4 years ago

I'm having the same problem, with the same input.

chenjinzhi1990 commented 4 years ago

delete name values

body = """
<html>
  <head>
    <meta  content="png"/>
    <meta  content="Landscape"/>
  </head>
  Hello World!
  </html>
"""
imgkit.from_string(body,'name.jpg')