Skip to content
File renamed without changes.
File renamed without changes.
12 changes: 2 additions & 10 deletions examples/html2pdf/acid.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,12 @@ <h1>sing to me, erbarme dich</h1>
<script>

var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;

canvas.width = 8.5 * 72;

html2canvas(document.body, {canvas:canvas})
.then(function(canvas) {
pdf.html(document.body, {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');

//var div = document.createElement('pre');
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
});
</script>
</body>
Expand Down
13 changes: 4 additions & 9 deletions examples/html2pdf/acid2.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,16 @@
function onLoad() {
window.setTimeout (function () {
var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 96 * 11;
canvas.width= 96 * 8.5;;
// var width = 400;

document.body.style.width = 400 + 'px';

html2pdf(document.body, pdf,
function(pdf) {
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.html(document.body, {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:fixed;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
}
);
}
});
}, 2000);
}
</script>
Expand Down
17 changes: 3 additions & 14 deletions examples/html2pdf/auto_break.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</style>
</head>
<body>
<div style='position: absolute; left: 0; top: 0; bottom: 0; width: 400px; overflow: auto'>
<div id="html" style='position: absolute; left: 0; top: 0; bottom: 0; width: 400px; overflow: auto'>
<h1>Autobreak</h1>
<p>The context2d plugin was tweaked to auto-break a document into multiple pages.</p>
<p>The auto-page-break feature allows vertical positioning by addressing the Y coordinate beyond the PDF page.</p>
Expand Down Expand Up @@ -147,24 +147,13 @@ <h1>Autobreak</h1>
<script src='../../dist/jspdf.debug.js'></script>
<script>
var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 96 * 11;
canvas.width= 96 * 8.5;;
// var width = 400;

document.body.style.width = 400 + 'px';

html2pdf(document.body, pdf, function(pdf) {
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');

//var div = document.createElement('pre');
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
);
});
</script>
</body>
</html>
17 changes: 7 additions & 10 deletions examples/html2pdf/lists.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</style>
</head>
<body>
<div style='position: absolute'>
<div id="html" style='position: absolute'>
<h1>Ordered And Unordered Lists</h1>
<h2>Implemented</h2>
<ol>
Expand Down Expand Up @@ -48,17 +48,14 @@ <h2>Not Implemented</h2>
<script>
var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 72 * 11;
canvas.width=72 * 8.5;;
// var width = 400;

html2pdf(document.body, pdf, function(canvas) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
}
);
});
</script>
</body>
</html>
9 changes: 3 additions & 6 deletions examples/html2pdf/page_break.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</style>
</head>
<body>
<div style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
<div id="html" style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
This example show how the <em>page-break-before</em> style is rendered.

<h1 style='page-break-before: always'>Numbers</h1>
Expand All @@ -38,16 +38,13 @@ <h1 style='page-break-before: always'>Text</h1>
<script src='../../dist/jspdf.debug.js'></script>
<script>
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.canvas.height = 72 * 11;
pdf.canvas.width = 72 * 8.5;

//html2pdf(document.documentElement.innerHTML, pdf, function(pdf){
html2pdf(document.body, pdf, function(pdf){
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
});
}});
</script>
</body>
</html>
12 changes: 3 additions & 9 deletions examples/html2pdf/pdf2.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</style>
</head>
<body>
<div style="background: red;">
<div id="html" style="background: red;">
<div style="background: green;">
<div style="background: blue; border-color: white;">
<div style="background: yellow;">
Expand Down Expand Up @@ -63,21 +63,15 @@ <h2>More content</h2>

<script>
var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
var width = 600;
//canvas.width=8.5*72;
document.body.style.width=width + "px";

html2canvas(document.body, {canvas:canvas})
.then(function(canvas) {
pdf.html(document.body, {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style', 'position:absolute;top:0;right:0;height:100%; width:600px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');

//var div = document.createElement('pre');
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
});
</script>
</body>
Expand Down
14 changes: 3 additions & 11 deletions examples/html2pdf/showcase.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</style>
</head>
<body>
<div style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
<div id="html" style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>


<h1>Html2Pdf</h1>
Expand Down Expand Up @@ -70,21 +70,13 @@ <h2>Font Size</h2>

<script>
var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 72 * 11;
canvas.width=72 * 8.5;;
// var width = 400;

html2pdf(document.body, pdf, function(pdf) {
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');

//var div = document.createElement('pre');
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
}
);

</script>
Expand Down
8 changes: 3 additions & 5 deletions examples/html2pdf/showcase_supported_html.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</style>
</head>
<body>
<div style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
<div id="html" style='position: absolute; left: 0; top: 0; bottom: 0; overflow: auto; width: 400px'>
<h1>HTML Test File</h1>
This page showcases all HTML supported features.
<hr>
Expand Down Expand Up @@ -204,14 +204,12 @@ <h2>External</h2>

<script>
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.canvas.height = 72 * 11;
pdf.canvas.width = 72 * 8.5;
html2pdf(document.body, pdf, function(pdf){
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
});
}});
</script>
</body>
</html>
15 changes: 3 additions & 12 deletions examples/html2pdf/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</style>
</head>
<body>
<div style='position: absolute'>
<div id="html" style='position: absolute'>
<h1>Tables</h1>
<table class='table1'>
<tr>
Expand Down Expand Up @@ -218,21 +218,12 @@ <h1>Tables</h1>
<script>

var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 72 * 11;
canvas.width=72 * 8.5;;
// var width = 400;
html2pdf(document.body, pdf, function(pdf) {
pdf.html(document.body, {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');

//var div = document.createElement('pre');
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
);
}});
</script>
</body>
</html>
11 changes: 3 additions & 8 deletions examples/html2pdf/total_mess.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</style>
</head>
<body>
<div style='position: absolute; left: 0; width: 400px'>
<div id="html" style='position: absolute; left: 0; width: 400px'>
<br />
<h1>Heading one</h1>
<h2>Header two</h2>
Expand Down Expand Up @@ -247,12 +247,7 @@ <h2>Div and Span Tests</h2>
<script>

var pdf = new jsPDF('p', 'pt', 'letter');
var canvas = pdf.canvas;
canvas.height = 72 * 11;
canvas.width=72 * 8.5;;
// var width = 400;

html2pdf(document.body, pdf,function(pdf) {
pdf.html(document.getElementById('html'), {callback: function(pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style','position:absolute;right:0; top:0; bottom:0; height:100%; width:500px');
document.body.appendChild(iframe);
Expand All @@ -262,7 +257,7 @@ <h2>Div and Span Tests</h2>
//div.innerText=pdf.output();
//document.body.appendChild(div);
}
);
});
</script>
</body>
</html>
78 changes: 0 additions & 78 deletions examples/test_from_html.html

This file was deleted.

1 change: 0 additions & 1 deletion main_libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import './libs/JPEGEncoder.js';
import './libs/BMPDecoder.js';
import './libs/Deflater.js';
import './libs/rgbcolor.js';
import './libs/html2pdf.js';
import './libs/ttffont.js';
import './libs/png.js';
import './libs/zlib.js';
Loading