mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix pdf format conversion
When calling the default converter (convert) we pass the format on the command line. In LyX we have various pdf, pdf2, pdf3, etc. formats all representing PDF. We need to strip to trailing digit in the format string otherwise the format is not understood by convert.
This commit is contained in:
parent
096204e23f
commit
73368ed2d9
@ -255,6 +255,13 @@ static void build_conversion_command(string const & command, ostream & script)
|
||||
}
|
||||
|
||||
|
||||
static string const strip_digit(string const & format)
|
||||
{
|
||||
// Strip trailing digits from format names e.g. "pdf6" -> "pdf"
|
||||
return format.substr(0, format.find_last_not_of("0123456789") + 1);
|
||||
}
|
||||
|
||||
|
||||
static void build_script(string const & from_file,
|
||||
string const & to_file,
|
||||
string const & from_format,
|
||||
@ -318,12 +325,12 @@ static void build_script(string const & from_file,
|
||||
<< libScriptSearch("$$s/scripts/convertDefault.py",
|
||||
quote_python) << ' ';
|
||||
if (!from_format.empty())
|
||||
os << from_format << ':';
|
||||
os << strip_digit(from_format) << ':';
|
||||
// The extra " quotes around infile and outfile are needed
|
||||
// because the filename may contain spaces and it is used
|
||||
// as argument of os.system().
|
||||
os << "' + '\"' + infile + '\"' + ' "
|
||||
<< to_format << ":' + '\"' + outfile + '\"' + '";
|
||||
<< strip_digit(to_format) << ":' + '\"' + outfile + '\"' + '";
|
||||
string const command = os.str();
|
||||
|
||||
LYXERR(Debug::GRAPHICS,
|
||||
|
Loading…
Reference in New Issue
Block a user