# Snapshot of Kibana 7.1 dashboard using phantomjs

**URL:** <https://discuss.elastic.co/t/snapshot-of-kibana-7-1-dashboard-using-phantomjs/191874>\
**Category:** Kibana\
**Tags:** elastic-stack-reporting\
**Created:** [July 23, 2019, 5:05pm UTC](https://discuss.elastic.co/t/snapshot-of-kibana-7-1-dashboard-using-phantomjs/191874 "2019-07-23T17:05:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajashree\_Sekar](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Rajashree\_Sekar](https://discuss.elastic.co/u/Rajashree_Sekar)\
**Post date:** [July 23, 2019, 5:05pm UTC](https://discuss.elastic.co/t/snapshot-of-kibana-7-1-dashboard-using-phantomjs/191874/1 "2019-07-23T17:05:27Z")

</div>

Hi,

Im using Kibana 7.1.1, and I want to capture pdf or png of Kibana dashboard.  
Tried below code, but it is capturing blank page.

======Code starts ======  
var page = require('webpage').create(),  
system = require('system'),  
address, output, size;  
//How to to wait for kibana to load and the data from elasticseatch in milliseconds.  
var waitTime = 10 \* 1000;

if (system.args.length \< 3 || system.args.length \> 5) {  
console.log('Usage: rasterize.js URL filename [paperwidth _paperheight|paperformat] [zoom]');  
console.log(' paper (pdf output) examples: "5in_ 7.5in", "10cm _20cm", "A4", "Letter"');  
phantom.exit(1);  
} else {  
address = system.args[1];  
output = system.args[2];  
page.viewportSize = { width: 1024, height: 1024 };  
if (system.args.length \> 3 && system.args[2].substr(-4) === ".pdf") {  
size = system.args[3].split('_ ');  
page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' }  
: { format: system.args[3], orientation: 'portrait', margin: '1cm' };  
}  
if (system.args.length \> 4) {  
page.zoomFactor = system.args[4];  
}  
page.open(address, function (status) {  
if (status !== 'success') {  
console.log('Unable to load the address!');  
phantom.exit();  
} else {  
window.setTimeout(function () {  
page.render(output);  
phantom.exit();  
}, waitTime);  
}  
});  
}  
======Code ends ======

command: \>phantomjs hello.js [http://localhost:5601/app/kibana#/dashboard/88bc09e0-9ed8-11e9-982a-b9c18cbffde2](http://localhost:5601/app/kibana#/dashboard/88bc09e0-9ed8-11e9-982a-b9c18cbffde2) kibi.pdf

Know that reporting plugin is there, but it is paid!!

Any leads will be more helpful!

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [July 24, 2019, 5:09pm UTC](https://discuss.elastic.co/t/snapshot-of-kibana-7-1-dashboard-using-phantomjs/191874/2 "2019-07-24T17:09:04Z")

</div>

It's a rather complex process to capture a PDF or PNG of a Kibana dashboard, which is why the Reporting plugin exists. Also, PhantomJS is a rather outdated browser, and an abandoned project, so I'd highly recommend using something like [Headless Chromium](https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md) instead.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2019, 5:09pm UTC](https://discuss.elastic.co/t/snapshot-of-kibana-7-1-dashboard-using-phantomjs/191874/3 "2019-08-21T17:09:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
