https://github.com/phronmophobic/htmltoimage
https://github.com/phronmophobic/htmltoimage
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/phronmophobic/htmltoimage
- Owner: phronmophobic
- License: epl-1.0
- Created: 2021-03-10T20:11:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-10T20:12:13.000Z (over 5 years ago)
- Last Synced: 2025-03-29T19:42:14.317Z (over 1 year ago)
- Language: Clojure
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# htmltoimage
Example of using clj-cef to convert a URL to an image.
## Linux Dependencies
```sh
apt install xvfb libatk1.0-dev libatk-bridge2.0-dev libxkbcommon-dev libxcomposite-dev libxrandr-dev libgbm-dev
```
## Framework dependencies
The cef framework is about 80MB compressed (~230MB uncompressed) which makes it a poor fit including within the library jar. On linux, the CEF framework is 300MB compressed and 1GB uncompressed.
Download the framework. This may take a while.
```sh
clojure -Sdeps '{:deps {com.phronemophobic/clirun {:mvn/version "1.0.0"}}}' -M -m com.phronemophobic.clirun com.phronemophobic.cef/download-and-extract-framework
```
## Usage
Note:If running on linux without a display, prefix commands with `xvfb-run`.
Basic usage:
$ clojure -X clj-cef.htmltoimage/-main :url '"https://blog.phronemophobic.com/what-is-a-user-interface.html"'
With xvfb:
$ xvfb-run clojure -X clj-cef.htmltoimage/-main :url '"https://blog.phronemophobic.com/what-is-a-user-interface.html"'
Extra options:
$ clojure -X clj-cef.htmltoimage/-main :url '"https://blog.phronemophobic.com/what-is-a-user-interface.html"' :size '[1000 300]' :out '"mysite.png"'
## License
Copyright © 2021 Adrian
Distributed under the Eclipse Public License version 1.0.