From 1f95988b292e1833501b6305f1d4afd97d5c00f9 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 8 Apr 2014 08:10:26 +0000 Subject: [PATCH] Make PDF export orientation dependent on width vs. height, based on "pt", and using the dimensions of the canvas (Todo: provide alternative of predefined jsPDF options like a4, legal, etc.) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2795 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index a54b44a2..d148f7d7 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1109,7 +1109,9 @@ TODOS } var c = $('#export_canvas')[0]; if (type === 'PDF') { - var doc = new jsPDF(); + var res = svgCanvas.getResolution(); + var orientation = res.w > res.h ? 'landscape' : 'portrait'; + var doc = new jsPDF(orientation, 'pt', [res.w, res.h]); // Todo: Give options to use predefined jsPDF formats like "a4", etc. from pull-down (with option to keep customizable) svgElementToPdf(data.svg, doc, {}); doc.save(svgCanvas.getDocumentTitle() + '.pdf'); return;