3

I try to print some ODT documents from LibreOffice 4 (Ubuntu 13.04 OS) to a Toshiba e-Studio 167 printer. When the document has fonts like Liberation Sans, Liberation Serif, etc., I get a printed page with the next error:

ERROR:
invalidfont
OFFENDING COMMAND
$definefont
STACK:
--nostringval--
/WASRNP+LiberationSerif
--nostringval--
/WASRNP+LiberationSerif
--nostringval--
--nostringval--
17

However, if export ODT file to PDF and I print PDF file or if I print another PDF file from Acrobat, there's no problem.

I've been trying the solutions given in this threads, but if I change printer language type to PostScript, I get the same error:

Unable to print from LibreOffice

Problem printing in LibreOffice Writer but not in Adobe Acrobat Reader or Evolution

To try to resolve the problem I configured incron in order to print to a PDF printer first, and then printing the file to the printer.

Any of this commands work from the command line, and the file is printed ok:

cat <file.pdf> | acroread -toPostScript | lpr -P <printer name>

cat pdf2ps <file.pdf> | lpr -P <printer name>

but it doesn't (the printer does nothing), if I put them in the file opened when running "incrontab -e".

incrontab -e

/home/<user>/PDF IN_CLOSE_WRITE cat $@/$# | acroread -toPostScript | lpr -P <printer name>

save the file

Or

incrontab -e

/home/<user>/PDF IN_CLOSE_WRITE cat pdf2ps $@/$# | lpr -P <printer name>

save the file

Incron works ok with other commands, like cp.

On the other hand, the next two possible configurations for "incrontab -e" make the printer work, but with the problem I mentioned at the begining. Could be a problem with pipes?

/home/launion/PDF IN_CLOSE_WRITE /usr/lib/libreoffice/program/soffice --invisible --norestore -pt <printer name> $@/$#

/home/launion/PDF IN_CLOSE_WRITE lpr -P <printer name> -o Resolution=600x600dpi -o PageSize=A4 -o Duplex=None $@/$#
1

In the end I solved the problem using a simple bash script (/usr/local/bin/print_pdf.sh), avoiding the use of pipes inside incrontab file:

#!/bin/bash
cat $1 | acroread -toPostScript | lpr -P <printer name>

Execution permision for all users:

sudo chmod a+x /usr/local/bin/print_pdf.sh

After that, as a normal user:

incrontab -e

/home/launion/PDF IN_CLOSE_WRITE print_pdf.sh $@/$#

save the file

Now, when printing to the virtual PDF printer, Toshiba printer will receive the file in PostScript and it will be printed ok.

I did not try with pdf2ps command but maybe it will work too.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.