2022-11-11 12:23:16 +03:00
|
|
|
# `html2svg`
|
|
|
|
|
2022-11-15 11:36:24 +03:00
|
|
|
Convert HTML and `<canvas>` to SVG or PDF using Chromium.
|
2022-11-11 12:23:16 +03:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```shell
|
2022-11-15 11:36:24 +03:00
|
|
|
# export to SVG
|
2022-11-14 11:58:00 +03:00
|
|
|
$ docker run fathyb/html2svg https://google.com > google.svg
|
2022-11-15 11:36:24 +03:00
|
|
|
$ docker run fathyb/html2svg https://google.com --format svg > google.svg
|
|
|
|
# export to PDF
|
|
|
|
$ docker run fathyb/html2svg https://google.com --format pdf > google.pdf
|
2022-11-11 12:23:16 +03:00
|
|
|
```
|
|
|
|
|
2022-11-14 11:58:00 +03:00
|
|
|
## Development
|
|
|
|
|
|
|
|
> - Building Chromium for ARM on Linux or Windows is not officially supported, cross-compile from x64 instead.
|
|
|
|
|
|
|
|
### Docker
|
2022-11-11 12:23:16 +03:00
|
|
|
|
|
|
|
```shell
|
2022-11-14 11:58:00 +03:00
|
|
|
$ docker buildx build . --platform linux/arm64,linux/amd64
|
2022-11-11 12:23:16 +03:00
|
|
|
```
|
|
|
|
|
2022-11-14 11:58:00 +03:00
|
|
|
### Local
|
2022-11-11 12:23:16 +03:00
|
|
|
|
|
|
|
1. Fetch dependencies:
|
|
|
|
```shell
|
|
|
|
$ yarn
|
|
|
|
```
|
|
|
|
2. Clone Electron.js and Chromium using `gclient`:
|
|
|
|
```shell
|
|
|
|
$ yarn gclient
|
|
|
|
```
|
|
|
|
3. Configure the build system using `gn` using one of these commands:
|
|
|
|
```shell
|
|
|
|
# for local developement
|
|
|
|
$ yarn gn testing
|
|
|
|
# or for releasing
|
|
|
|
$ yarn gn release
|
|
|
|
# add --ide=xcode if you'd like to generate an Xcode project on macOS
|
|
|
|
$ yarn gn release --ide=xcode
|
|
|
|
```
|
|
|
|
4. Build using `ninja` using one of these commands:
|
|
|
|
```shell
|
|
|
|
# make a testing build
|
|
|
|
$ yarn ninja testing
|
|
|
|
# make a release build
|
|
|
|
$ yarn ninja release
|
|
|
|
```
|