wch / webshot

Take screenshots of web pages from R
http://wch.github.io/webshot/
227 stars 40 forks source link

webshot on ubuntu 16.04.5 LTS vs macOS Mojave 10.14.3 #81

Closed klopianoRTA closed 5 years ago

klopianoRTA commented 5 years ago

I'm running the exact same code on a local Mac machine R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.3 webshot::webshot("test.html", file = "test-local.png", delay = 2, vwidth = 1450) test-local

And a remote linux machine R version 3.4.4 (2018-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.5 LTS

webshot::webshot("/screenshots/test.html", file = "/screenshots/test-remote.png", delay = 2, vwidth = 1450)

test-remote

Any thoughts on how to have the result on the remote machine be identical to the result on the local machine? The local version is what I need to be created on the remote machine.

My .Rmd file and the test.html file are in the following archive

test.zip

klopianoRTA commented 5 years ago

I resolved this by updating phantomjs directly at the command line. Using webshot::install_phantomjs() appeared to install 2.1.1 but I needed to update at system level for it to work.

sudo apt-get update sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y

sudo apt-get install libfreetype6 libfreetype6-dev -y

sudo apt-get install libfontconfig1 libfontconfig1-dev -y

cd ~

export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"

wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2

sudo tar xvjf $PHANTOM_JS.tar.bz2

sudo mv $PHANTOM_JS /usr/local/share

sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

phantomjs --version