Skip to content

Commit 397c19c

Browse files
committed
Improve Safari support, update documentation, improve preview pane
1 parent 4c8cb72 commit 397c19c

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

examples/css/editor.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ footer {
1717
font-size: 14px;
1818
}
1919

20+
.preview-pane {
21+
border: 3px solid #ccc;
22+
}
23+
2024
.controls {
2125
float: left;
2226
clear: left;

examples/js/editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ <h2>The Basics</h2>
8686

8787
<p>Simply include the jsPDF library in your <span class="source">&lt;head&gt;</span>, generate your PDF using the <i>many</i> built-in functions, then hook up a button to trigger the download. All the examples here use jQuery.</p>
8888

89+
<h2>Browser Compatibility</h2>
90+
91+
<p>jsPDF will work in IE6+*, Firefox 3+, Chrome, Safari 3+, Opera. For IE9 and below, we lazily load a Flash shim called Downloadify which enables the files to be downloaded.</p>
92+
93+
<p>* Current build does not have IE6-9 shim enabled</p>
94+
8995
<h2>Credits</h2>
9096

9197
<p>Big thanks to Daniel Dotsenko from <a href="http://willow-systems.com">Willow Systems Corporation</a> for making huge contributions to the codebase. </p>

jspdf.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,16 @@ function jsPDF(/** String */ orientation, /** String */ unit, /** String */ form
16841684
case undef:
16851685
return buildDocument();
16861686
case 'save':
1687+
1688+
// If Safari - fallback to Data URL, sorry there's no way to feature detect this
1689+
// @TODO: Refactor this
1690+
$.browser.chrome = $.browser.webkit && !!window.chrome;
1691+
$.browser.safari = $.browser.webkit && !window.chrome;
1692+
1693+
if ($.browser.safari) {
1694+
return API.output('dataurlnewwindow');
1695+
}
1696+
16871697
var bb = new BlobBuilder;
16881698
var data = buildDocument();
16891699

@@ -1706,6 +1716,10 @@ function jsPDF(/** String */ orientation, /** String */ unit, /** String */ form
17061716
case 'datauri':
17071717
case 'dataurl':
17081718
document.location.href = 'data:application/pdf;base64,' + btoa(buildDocument()); break;
1719+
break;
1720+
case 'dataurlnewwindow':
1721+
window.open('data:application/pdf;base64,' + btoa(buildDocument()));
1722+
break;
17091723
default: throw new Error('Output type "'+type+'" is not supported.')
17101724
}
17111725
// @TODO: Add different output options

0 commit comments

Comments
 (0)