PDF export in server_opensave extension

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2886 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-06-13 14:58:46 +00:00
parent c9d7d008fa
commit 6bffe68d65
2 changed files with 19 additions and 3 deletions

View File

@ -5,7 +5,8 @@ $allowedMimeTypesBySuffix = array(
'png' => 'image/png',
'jpeg' => 'image/jpeg',
'bmp' => 'image/bmp',
'webp' => 'image/webp'
'webp' => 'image/webp',
'pdf' => 'application/pdf'
);
?>

View File

@ -1,5 +1,5 @@
/*globals svgEditor, svgedit, svgCanvas, canvg, $*/
/*jslint eqeq: true*/
/*jslint eqeq: true, browser:true*/
/*
* ext-server_opensave.js
*
@ -56,7 +56,22 @@ svgEditor.addExtension("server_opensave", {
.appendTo('body')
.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"
exportImage: function(win, data) {
var c,