Skip to content

Commit

Permalink
update development test file examples
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed May 18, 2018
1 parent 3a3c604 commit 499ed64
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "print-js",
"homepage": "http://printjs.crabbly.com",
"description": "A tiny javascript library to help printing from the web.",
"version": "1.0.41",
"version": "1.0.42",
"main": "dist/print.js",
"repository": "https://github.com/crabbly/Print.js",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@media print {
h1 {
color: red;
font-size: 40px;
}
}
54 changes: 39 additions & 15 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,36 @@
});
}

function printHtmlCustom() {
const css = `
function printHtmlCustomStyle() {
const style = `
@page {
margin: 0
}
@media print {
h1 {
color: blue
}
}
`

printJS({
printable: 'test',
type: 'html',
css: css,
style: style,
scanStyles: false
});
}

function printHtmlCss() {
printJS({
printable: 'test',
type: 'html',
css: 'test.css',
scanStyles: false
});
}

function printJson() {
let data = [
{
Expand All @@ -49,18 +64,27 @@
<body>
<section id="test" class="test">
<h1>Print.js Test Page</h1>
<button onClick='printPdf();'>
Print PDF
</button>
<button onClick='printHtml();'>
Print HTML
</button>
<button onClick='printHtmlCustom();'>
Print HTML with custom css
</button>
<button onClick='printJson();'>
Print JSON
</button>
<p>
<button onClick='printPdf();'>
Print PDF
</button>
</p>
<p>
<button onClick='printHtml();'>
Print HTML
</button>
<button onClick='printHtmlCustomStyle();'>
Print HTML with custom style
</button>
<button onClick='printHtmlCss();'>
Print HTML with custom css
</button>
</p>
<p>
<button onClick='printJson();'>
Print JSON
</button>
</p>
</section>
</body>
</html>

0 comments on commit 499ed64

Please sign in to comment.