Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

[resolved] Error loading dash_core_components with PhantomJS

Hello awesome Dash community :slight_smile:

I’m having a little with generating PDF using PhantomJS and Dash :confused:

I’ve followed examples on how to generate “pixel perfect” pdf with phantomjs, but apparently there is a problem between phantomjs and unpkg.

Here is a screenshot of my console when I launch a simple phantom command to get the pdf of the https://dash.plot.ly page:

And the test.js file read by phantomjs:

var page = require('webpage').create();
page.open('http://dash.plot.ly', function(status) {
	console.log("Status: " + status);
	window.setTimeout(function () {
	  if(status === "success") {
	    page.render('example.pdf', {format: 'pdf'});
	  }
	  phantom.exit();
	}, 10000);
});

Have you ever heard of any problem with phantomjs and dash?

By the way, I’ll should upload soon a little dash plugin to implement the reactour (https://github.com/elrumordelaluz/reactour) component to generate nice help for Dash apps :slight_smile:

Many thanks,
R

1 Like

I’m not sure what that particular issue is, but you could also try using Headless Chrome to print the DOM to a PDF.

Hello @nedned and thank you for the reply :slight_smile:

I have followed your suggestion and it works! The plots are correctly rendered with it so it’s great. So I guess the problem comes from phantomJS :confused:

To be more precise about what I have done if someone has the same problem: I used puppeteer with nodeJS to create an automatic script that print in pdf my dashboard (https://github.com/GoogleChrome/puppeteer).

Ciao :slight_smile:

1 Like