416 |
416 |
return $display;
|
417 |
417 |
}
|
418 |
418 |
|
|
419 |
sub _run_python_uno {
|
|
420 |
my ($self, @args) = @_;
|
|
421 |
|
|
422 |
local $ENV{PYTHONPATH};
|
|
423 |
$ENV{PYTHONPATH} = $::lx_office_conf{environment}->{python_uno_path} . ':' . $ENV{PYTHONPATH} if $::lx_office_conf{environment}->{python_uno_path};
|
|
424 |
my $cmd = $::lx_office_conf{applications}->{python_uno} . ' ' . join(' ', @args);
|
|
425 |
return `$cmd`;
|
|
426 |
}
|
|
427 |
|
419 |
428 |
sub is_openoffice_running {
|
|
429 |
my ($self) = @_;
|
|
430 |
|
420 |
431 |
$main::lxdebug->enter_sub();
|
421 |
432 |
|
422 |
|
my $cmd = "./scripts/oo-uno-test-conn.py " . $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . " 2> /dev/null";
|
423 |
|
my $output = `$cmd`;
|
|
433 |
my $output = $self->_run_python_uno('./scripts/oo-uno-test-conn.py', $::lx_office_conf{print_templates}->{openofficeorg_daemon_port}, ' 2> /dev/null');
|
424 |
434 |
chomp $output;
|
425 |
435 |
|
426 |
436 |
my $res = ($? == 0) || $output;
|
... | ... | |
508 |
518 |
return 0;
|
509 |
519 |
}
|
510 |
520 |
|
511 |
|
my @cmdline;
|
512 |
521 |
if (!$::lx_office_conf{print_templates}->{openofficeorg_daemon}) {
|
513 |
|
@cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer},
|
514 |
|
"-minimized", "-norestore", "-nologo", "-nolockcheck",
|
515 |
|
"-headless",
|
516 |
|
"file:${filename}.odt",
|
517 |
|
"macro://" . (split('/', $filename))[-1] .
|
518 |
|
"/Standard.Conversion.ConvertSelfToPDF()");
|
|
522 |
system($::lx_office_conf{applications}->{openofficeorg_writer},
|
|
523 |
"-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless",
|
|
524 |
"file:${filename}.odt",
|
|
525 |
"macro://" . (split('/', $filename))[-1] . "/Standard.Conversion.ConvertSelfToPDF()");
|
519 |
526 |
} else {
|
520 |
527 |
if (!$self->spawn_openoffice()) {
|
521 |
528 |
$main::lxdebug->leave_sub();
|
522 |
529 |
return 0;
|
523 |
530 |
}
|
524 |
531 |
|
525 |
|
@cmdline = ("./scripts/oo-uno-convert-pdf.py",
|
526 |
|
$::lx_office_conf{print_templates}->{openofficeorg_daemon_port},
|
527 |
|
"${filename}.odt");
|
|
532 |
$self->_run_python_uno('./scripts/oo-uno-convert-pdf.py', $::lx_office_conf{print_templates}->{openofficeorg_daemon_port}, "${filename}.odt");
|
528 |
533 |
}
|
529 |
534 |
|
530 |
|
system(@cmdline);
|
531 |
|
|
532 |
535 |
my $res = $?;
|
533 |
536 |
if ((0 == $?) || (-f "${filename}.pdf" && -s "${filename}.pdf")) {
|
534 |
537 |
$form->{"tmpfile"} =~ s/odt$/pdf/;
|
Python-Interpreter und -Modulpfad über Konfigurationsoptionen in kivitendo.conf konfigurierbar gemacht
Behebt #671.