Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5666916
initial support for EMF file format thanks to Inkscape
antoinerg Nov 27, 2018
e823274
remove PATCH version from docker image name to get updates
antoinerg Nov 27, 2018
035ed22
fix regular expression to match svg attributes with dash
antoinerg Nov 27, 2018
40437c4
circleci: debian-jessie -> debien-strecth to get inkscape 0.9x
antoinerg Nov 27, 2018
25f0bb6
properly check test-mock.emf size and fix lint
antoinerg Nov 27, 2018
e2f2be7
missing deps, need to update package lists
antoinerg Nov 27, 2018
5ed1198
minor code style fix
antoinerg Nov 29, 2018
fc8c755
check Inkscape's version, provide meaning error message when --verbose
antoinerg Nov 30, 2018
1ecb2f4
parse SVG using jsdom instead of regexes
antoinerg Dec 3, 2018
7dddce5
jsdom 13.0.0 -> 11.12.0 to support node.js v6
antoinerg Dec 3, 2018
6b1a1fc
find image elements using jsdom
antoinerg Dec 4, 2018
d4a1bfa
gl3d: use bg color from figure.layout if provided
antoinerg Dec 4, 2018
5432b59
fix lint
antoinerg Dec 4, 2018
212ed21
fix Inkscape unit test
antoinerg Dec 4, 2018
37747b1
relax constraint for Inkscape's version: now requires gte 0.92.x
antoinerg Dec 5, 2018
315a7d6
use different port for orca_serve_graph-only_test.js
antoinerg Dec 5, 2018
48e1e11
npm install with latest npm version
antoinerg Dec 5, 2018
c1822e2
teardown server last, orca should reply 404 instead of ECONNREFUSED
antoinerg Dec 6, 2018
ffc9bfd
cache node_modules only if package-lock.json didn't change
antoinerg Dec 6, 2018
e24f167
install Inkscape in deployment container
antoinerg Dec 6, 2018
e76c52b
improve code readability and style
antoinerg Dec 6, 2018
e4ab53d
safer code which ensures there is a figure.layout object
antoinerg Dec 6, 2018
b6daae1
revert to ubuntu:xenial, install latest Inkscape from a PPA
antoinerg Dec 6, 2018
f117d36
run `apt-get update` prior to installing Inkscape to get latest version
antoinerg Dec 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
name: Install deps
command: |
npm install
sudo apt-get install poppler-utils libgconf-2-4
sudo apt-get update
sudo apt-get install inkscape poppler-utils libgconf-2-4
- run:
name: List deps
command: |
Expand All @@ -83,16 +84,16 @@ jobs:
test-node-v6:
<<: *base
docker:
- image: circleci/node:6.14.1-browsers
- image: circleci/node:6.14-stretch-browsers

test-node-v8:
<<: *base
docker:
- image: circleci/node:8.11.1-browsers
- image: circleci/node:8.11-stretch-browsers

docker-build-and-push:
docker:
- image: circleci/node:8.11.1-browsers
- image: circleci/node:8.11-stretch-browsers
steps:
- setup_remote_docker:
reusable: true
Expand Down Expand Up @@ -138,7 +139,7 @@ jobs:

electron-pack-and-release:
docker:
- image: circleci/node:8.11.1-browsers
- image: circleci/node:8.11-stretch-browsers
steps:
- restore_cache:
key: v1-source-{{ .Branch }}-{{ .Revision }}
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ npm install -g electron@1.8.4 orca

which makes the `orca` executable available in your path.

### Method 3: Standalone binaries
### Method 3: Standalone binaries

Alternatively, you can download the standalone Orca binaries corresponding to
your operating system from the
Expand All @@ -52,7 +52,7 @@ your operating system from the
- A password dialog will appear asking for permission to add orca to your system `PATH`.
- Enter you password and click _OK_.
- This should open an _Installation Succeeded_ window.
- Open a new terminal and verify that the orca executable is available on your `PATH`.
- Open a new terminal and verify that the orca executable is available on your `PATH`.

```
$ which orca
Expand Down Expand Up @@ -100,7 +100,7 @@ to the AppImage.
$ ln -s /path/to/orca-X.Y.Z-x86_64.AppImage /somewhere/on/PATH/orca
```

- Open a new terminal and verify that the orca executable is available on your `PATH`.
- Open a new terminal and verify that the orca executable is available on your `PATH`.

```
$ which orca
Expand All @@ -112,7 +112,7 @@ Plotly's image-exporting utilities
Usage: orca [--version] [--help] <command> [<args>]
...
```

##### Linux Troubleshooting: Cannot open shared object
The Electron runtime depends a several common system libraries. These
libraries are pre-installed in most desktop Linux distributions
Expand Down Expand Up @@ -157,7 +157,7 @@ Name this shell script `orca` and place it somewhere or your system `PATH`.
- How to add directory to system path in Linux: https://www.computerhope.com/issues/ch001647.htm
- AppImage: https://appimage.org/
- Xvfb: https://en.wikipedia.org/wiki/Xvfb

## Quick start

From the command line:
Expand Down Expand Up @@ -286,14 +286,14 @@ Plotly's image server is dockerized and deployed here. See the `deployment/`

## System dependencies

**If you don't care about exporting EPS you can skip this section.**
**If you don't care about exporting EPS or EMF you can skip this section.**

The environment you're installing this into may require Poppler for EPS exports.
The environment you're installing this into may require Poppler for EPS exports and Inkscape for EMF exports.

#### Poppler installation via Aptitude (used by some \*nix/BSD, e.g. Ubuntu)

```
$ apt-get poppler-utils (requires `sudo` or root privileges)
$ apt-get install poppler-utils (requires `sudo` or root privileges)
```

#### Poppler installation via Homebrew (third-party package manager for Mac OS X)
Expand All @@ -302,6 +302,17 @@ $ apt-get poppler-utils (requires `sudo` or root privileges)
$ brew install poppler
```

#### Inkscape installation via Aptitude (used by some \*nix/BSD, e.g. Ubuntu)

```
$ apt-get install inkscape (requires `sudo` or root privileges)
```

#### Inkscape installation via Homebrew (third-party package manager for Mac OS X)

```
$ brew install inkscape
```
## Contributing

See
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ platform:
#services:

cache:
- node_modules
- node_modules -> package-lock.json
- '%LOCALAPPDATA%\electron\Cache'
- '%LOCALAPPDATA%\electron-builder\cache'

Expand Down
6 changes: 6 additions & 0 deletions bin/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ exports.PLOTLYJS_OPTS_META = [{
alias: ['MathJax'],
dflt: '',
description: `Sets path to MathJax files. Required to export LaTeX characters.`
}, {
name: 'inkscape',
type: 'string',
alias: ['Inkscape'],
dflt: '',
description: `Sets path to Inkscape executable. Required to export WMF and EMF formats.`
}, {
name: 'safe-mode',
type: 'boolean',
Expand Down
3 changes: 2 additions & 1 deletion bin/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ function main (args) {
scale: opts.scale,
width: opts.width,
height: opts.height,
safeMode: opts.safeMode
safeMode: opts.safeMode,
inkscape: opts.inkscape
}
}
})
Expand Down
3 changes: 2 additions & 1 deletion bin/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ function main (args) {
mapboxAccessToken: opts['mapbox-access-token'],
mathjax: opts.mathjax,
topojson: opts.topojson,
safeMode: opts.safeMode
safeMode: opts.safeMode,
inkscape: opts.inkscape
}

function launch () {
Expand Down
4 changes: 2 additions & 2 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:xenial
FROM ubuntu:bionic
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. We'll have to test that thoroughly on stage. Is this required?

Copy link
Copy Markdown
Collaborator Author

@antoinerg antoinerg Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely the path of least resistance to get the latest version of Inkscape (0.92.3 which is also the version I used in my testing). Otherwise we'd have to compile Inkscape in the container.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a ppa shouldn't be too bad:

http://ubuntuhandbook.org/index.php/2017/01/install-inkscape-0-92-ppa-ubuntu-16-04-16-10-14-04/


I'm not against bumping Ubuntu, but we can't just casually bump it here w/o some thorough manual testing.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your concern. Let me try to compile Inkscape or install from a deb package.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a ppa shouldn't be too bad:

That did the trick thank you 👍

Commit b6daae1 reverted our container to ubuntu:xenial and install Inkscape from a PPA

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing 🎉

Thanks very much!


####################
# Install node and dependencies
Expand Down Expand Up @@ -90,7 +90,7 @@ RUN apt-get update -y && apt-get install -y subversion && \
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' && \
apt-get update -y && \
apt-get install -y google-chrome-stable xvfb poppler-utils git && \
apt-get install -y google-chrome-stable xvfb poppler-utils inkscape git && \
Copy link
Copy Markdown
Contributor

@etpinard etpinard Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried running that locally?

If I remember correctly:

docker build . -f deployment/Dockerfile -t tmp-inkscape

# check if ok with
docker images

docker run tmp-inkscape -d -p 9010:9010 tmp-inkscape

# then
curl localhost:9010 ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default port is 9091

Copy link
Copy Markdown
Collaborator Author

@antoinerg antoinerg Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following works for me!

docker build . -f deployment/Dockerfile -t tmp-inkscape

# check if ok with
docker images

docker run tmp-inkscape -d -p 9091:9091 tmp-inkscape

# then
cd plotly/plotly.js/test/image/mocks/
curl -XPOST -d @14.json localhost:9091 > /tmp/14.png

rm -rf /var/lib/apt/lists/* && apt-get clean

COPY package.json /var/www/image-exporter/
Expand Down
Loading