summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-04-06 14:17:29 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-04-06 14:17:29 +0000
commit08e8570373c4764f8a8f4146eb2d2dc43c02cb06 (patch)
tree73217c4d1b43b25691f4860b2c9f5d96fc30fc63 /src/main.cpp
parentfix bug where extension radiobutton parameters cannot be set from cmdline (e.... (diff)
downloadinkscape-08e8570373c4764f8a8f4146eb2d2dc43c02cb06.tar.gz
inkscape-08e8570373c4764f8a8f4146eb2d2dc43c02cb06.zip
add --export-margin option to PDF/EPS/PS export cmdline
(bzr r12268)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 58ab19616..5bb42d405 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -135,6 +135,7 @@ enum {
SP_ARG_EXPORT_AREA,
SP_ARG_EXPORT_AREA_DRAWING,
SP_ARG_EXPORT_AREA_PAGE,
+ SP_ARG_EXPORT_MARGIN,
SP_ARG_EXPORT_AREA_SNAP,
SP_ARG_EXPORT_WIDTH,
SP_ARG_EXPORT_HEIGHT,
@@ -186,6 +187,7 @@ static gchar *sp_export_dpi = NULL;
static gchar *sp_export_area = NULL;
static gboolean sp_export_area_drawing = FALSE;
static gboolean sp_export_area_page = FALSE;
+static gchar *sp_export_margin = NULL;
static gboolean sp_export_latex = FALSE;
static gchar *sp_export_width = NULL;
static gchar *sp_export_height = NULL;
@@ -229,6 +231,7 @@ static void resetCommandlineGlobals() {
sp_export_area = NULL;
sp_export_area_drawing = FALSE;
sp_export_area_page = FALSE;
+ sp_export_margin = NULL;
sp_export_latex = FALSE;
sp_export_width = NULL;
sp_export_height = NULL;
@@ -316,6 +319,11 @@ struct poptOption options[] = {
N_("Exported area is the entire page"),
NULL},
+ {"export-margin", 0,
+ POPT_ARG_STRING, &sp_export_margin, SP_ARG_EXPORT_MARGIN,
+ N_("Only for PS/EPS/PDF, sets margin in mm around exported area (default 0)"),
+ N_("VALUE")},
+
{"export-area-snap", 0,
POPT_ARG_NONE, &sp_export_area_snap, SP_ARG_EXPORT_AREA_SNAP,
N_("Snap the bitmap export area outwards to the nearest integer values (in SVG user units)"),
@@ -1623,6 +1631,13 @@ static int do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime)
(*i)->set_param_int("resolution", (int) dpi);
}
+ // if no bleed/margin is given, set to 0 (otherwise it takes the value last used from the UI)
+ float margin = 0.;
+ if (sp_export_margin) {
+ margin = g_ascii_strtod(sp_export_margin, NULL);
+ }
+ (*i)->set_param_float("bleed", margin);
+
//check if specified directory exists
if (!Inkscape::IO::file_directory_exists(uri)) {
g_warning("File path \"%s\" includes directory that doesn't exist.\n", uri);