File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,9 @@ var jsPDF = (function(global) {
751
751
* @name output
752
752
*/
753
753
output = SAFE ( function ( type , options ) {
754
+ var datauri = ( '' + type ) . substr ( 0 , 6 ) === 'dataur'
755
+ ? 'data:application/pdf;base64,' + btoa ( buildDocument ( ) ) :0 ;
756
+
754
757
switch ( type ) {
755
758
case undefined :
756
759
return buildDocument ( ) ;
@@ -778,13 +781,14 @@ var jsPDF = (function(global) {
778
781
return global . URL && global . URL . createObjectURL ( getBlob ( ) ) || void 0 ;
779
782
case 'datauristring' :
780
783
case 'dataurlstring' :
781
- return 'data:application/pdf;base64,' + btoa ( buildDocument ( ) ) ;
784
+ return datauri ;
785
+ case 'dataurlnewwindow' :
786
+ var nW = global . open ( datauri ) ;
787
+ if ( nW || typeof safari === "undefined" ) return nW ;
788
+ /* pass through */
782
789
case 'datauri' :
783
790
case 'dataurl' :
784
- return global . document . location . href = 'data:application/pdf;base64,' + btoa ( buildDocument ( ) ) ;
785
- case 'dataurlnewwindow' :
786
- return global . open ( 'data:application/pdf;base64,' + btoa ( buildDocument ( ) ) ) ;
787
- break ;
791
+ return global . document . location . href = datauri ;
788
792
default :
789
793
throw new Error ( 'Output type "' + type + '" is not supported.' ) ;
790
794
}
You can’t perform that action at this time.
0 commit comments