PDF export in server_opensave extension
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2886 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
c9d7d008fa
commit
6bffe68d65
|
@ -5,7 +5,8 @@ $allowedMimeTypesBySuffix = array(
|
||||||
'png' => 'image/png',
|
'png' => 'image/png',
|
||||||
'jpeg' => 'image/jpeg',
|
'jpeg' => 'image/jpeg',
|
||||||
'bmp' => 'image/bmp',
|
'bmp' => 'image/bmp',
|
||||||
'webp' => 'image/webp'
|
'webp' => 'image/webp',
|
||||||
|
'pdf' => 'application/pdf'
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,5 +1,5 @@
|
||||||
/*globals svgEditor, svgedit, svgCanvas, canvg, $*/
|
/*globals svgEditor, svgedit, svgCanvas, canvg, $*/
|
||||||
/*jslint eqeq: true*/
|
/*jslint eqeq: true, browser:true*/
|
||||||
/*
|
/*
|
||||||
* ext-server_opensave.js
|
* ext-server_opensave.js
|
||||||
*
|
*
|
||||||
|
@ -56,7 +56,22 @@ svgEditor.addExtension("server_opensave", {
|
||||||
.appendTo('body')
|
.appendTo('body')
|
||||||
.submit().remove();
|
.submit().remove();
|
||||||
},
|
},
|
||||||
// Todo: Add exportPDF!
|
exportPDF: function (win, data) {
|
||||||
|
var filename = getFileNameFromTitle(),
|
||||||
|
datauri = data.dataurlstring;
|
||||||
|
if (clientDownloadSupport(filename, '.pdf', datauri)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('<form>').attr({
|
||||||
|
method: 'post',
|
||||||
|
action: save_img_action,
|
||||||
|
target: 'output_frame'
|
||||||
|
}).append('<input type="hidden" name="output_img" value="' + datauri + '">')
|
||||||
|
.append('<input type="hidden" name="mime" value="application/pdf">')
|
||||||
|
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
|
||||||
|
.appendTo('body')
|
||||||
|
.submit().remove();
|
||||||
|
},
|
||||||
// Todo: Integrate this extension with a new built-in exportWindowType, "download"
|
// Todo: Integrate this extension with a new built-in exportWindowType, "download"
|
||||||
exportImage: function(win, data) {
|
exportImage: function(win, data) {
|
||||||
var c,
|
var c,
|
||||||
|
|
Loading…
Reference in New Issue