Is there any wkhtmltopdf option to convert html text rather than file?

后端 未结 5 832
栀梦
栀梦 2021-02-19 09:47

I recently stumbled on wkhtmltopdf and have found it to be an excellent tool for on-the-fly conversion from html to pdf in the browser.

A typical usage (in Windows) woul

5条回答
  •  逝去的感伤
    2021-02-19 10:04

    Using PowerShell, you can do it like this:

    $html = "

    Magical Ponies

    Once upon a time in Horseland, there was a band of miniat ure creatures..." $html | .\wkhtmltopdf.exe - C:\temp\test.pdf

    Just make sure you're running the code from within the \bin\ directory of wkhtmltopdf, otherwise, you'd have to provide a full path to the executable.

提交回复
热议问题