Commit 8a8162e1 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 2e68a0ca
const nodeHtmlToImage = require('node-html-to-image') const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent( html );
await page.screenshot({path: 'example.png'});
await browser.close();
})();
let html='<!DOCTYPE html>\n' +
'<html>\n' +
'<head>\n' +
'<meta name="viewport" content="width=device-width, initial-scale=1">\n' +
'<style>\n' +
'table {\n' +
' border-collapse: collapse;\n' +
' border-spacing: 0;\n' +
' width: 100%;\n' +
' border: 1px solid #ddd;\n' +
'}\n' +
'\n' +
'th, td {\n' +
' text-align: left;\n' +
' padding: 8px;\n' +
'}\n' +
'\n' +
'tr:nth-child(even){background-color: #f2f2f2}\n' +
'</style>\n' +
'</head>\n' +
'<body>\n' +
'\n' +
'<h2>Responsive Table</h2>\n' +
'<p>If you have a table that is too wide, you can add a container element with overflow-x:auto around the table, and it will display a horizontal scroll bar when needed.</p>\n' +
'<p>Resize the browser window to see the effect. Try to remove the div element and see what happens to the table.</p>\n' +
'\n' +
'<div style="overflow-x:auto;">\n' +
' <table>\n' +
' <tr>\n' +
' <th>First Name</th>\n' +
' <th>Last Name</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' <th>Points</th>\n' +
' </tr>\n' +
' <tr>\n' +
' <td>Jill</td>\n' +
' <td>Smith</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' <td>50</td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td>Eve</td>\n' +
' <td>Jackson</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' <td>94</td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td>Adam</td>\n' +
' <td>Johnson</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' <td>67</td>\n' +
' </tr>\n' +
' </table>\n' +
'</div>\n' +
'\n' +
'</body>\n' +
'</html>\n'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment