summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5bb42d405..d9e731912 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -148,6 +148,7 @@ enum {
SP_ARG_EXPORT_PS,
SP_ARG_EXPORT_EPS,
SP_ARG_EXPORT_PDF,
+ SP_ARG_EXPORT_PDF_VERSION,
SP_ARG_EXPORT_LATEX,
#ifdef WIN32
SP_ARG_EXPORT_EMF,
@@ -201,6 +202,7 @@ static gchar *sp_export_svg = NULL;
static gchar *sp_export_ps = NULL;
static gchar *sp_export_eps = NULL;
static gchar *sp_export_pdf = NULL;
+static gchar *sp_export_pdf_version = NULL;
#ifdef WIN32
static gchar *sp_export_emf = NULL;
#endif //WIN32
@@ -245,6 +247,7 @@ static void resetCommandlineGlobals() {
sp_export_ps = NULL;
sp_export_eps = NULL;
sp_export_pdf = NULL;
+ sp_export_pdf_version = NULL;
#ifdef WIN32
sp_export_emf = NULL;
#endif //WIN32
@@ -386,6 +389,12 @@ struct poptOption options[] = {
N_("Export document to a PDF file"),
N_("FILENAME")},
+ {"export-pdf-version", 0,
+ POPT_ARG_STRING, &sp_export_pdf_version, SP_ARG_EXPORT_PDF_VERSION,
+ // TRANSLATORS: "--export-pdf-version" is an Inkscape command line option; see "inkscape --help"
+ N_("Export PDF to given version. (hint: make sure to input the exact string found in the PDF export dialog, e.g. \"PDF 1.4\" which is PDF-a conformant)"),
+ N_("PDF_VERSION")},
+
{"export-latex", 0,
POPT_ARG_NONE, &sp_export_latex, SP_ARG_EXPORT_LATEX,
N_("Export PDF/PS/EPS without text. Besides the PDF/PS/EPS, a LaTeX file is exported, putting the text on top of the PDF/PS/EPS file. Include the result in LaTeX like: \\input{latexfile.tex}"),
@@ -1638,6 +1647,33 @@ static int do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime)
}
(*i)->set_param_float("bleed", margin);
+ // handle --export-pdf-version
+ bool set_export_pdf_version_fail=true;
+ const gchar *pdfver_param_name="PDFversion";
+ if(sp_export_pdf_version) {
+ // combine "PDF " and the given command line
+ std::string version_gui_string=std::string("PDF ")+sp_export_pdf_version;
+ try{
+ // first, check if the given pdf version is selectable in the ComboBox
+ if((*i)->get_param_enum_contains("PDFversion", version_gui_string.c_str())) {
+ (*i)->set_param_enum(pdfver_param_name, version_gui_string.c_str());
+ set_export_pdf_version_fail=false;
+ } else {
+ g_warning("Desired PDF export version \"%s\" not supported! Hint: input one of the versions found in the pdf export dialog e.g. \"1.4\".",
+ sp_export_pdf_version);
+ }
+ } catch (...) {
+ // can be thrown along the way:
+ // throw Extension::param_not_exist();
+ // throw Extension::param_not_enum_param();
+ g_warning("Parameter or Enum \"%s\" might not exist",pdfver_param_name);
+ }
+ }
+ // set default pdf export version to 1.4, also if something went wrong
+ if(set_export_pdf_version_fail) {
+ (*i)->set_param_enum(pdfver_param_name, "PDF 1.4");
+ }
+
//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);