Print word doc using lpr command

Hi ,

We are trying to automate Printing the word document directly from the Server level to a Printer.
We have printer registered and command I use is

lp -d printername 1234.doc

Even though the program completes fine, a print does not reach to the printer for word document. In order to make sure, I passed a PDF file and it got Printed fine.

After extensive checks I found I need to convert DOC into PDF and then print.

  1. Can we print a Word document directly from server instead of converting it?
  2. If We need to convert to PDF is there a way to do it without any installation. (Libreoffice is one option, but it needs installation)

Kindly advice.

Regards,
Prashant

Are you asking for a command-line to convert from one format to the other, perhaps with something magical like a one-line awk to reformat it? I think that there are companies that sell this sort of thing for the reason that it is very complex, however there may be some free tools out there.

I found this very useful:- linux convert doc to pdf

They will, of course, have to be installed so that breaks your requirement I'm afraid. :rolleyes:

Robin

1 Like

Hi Robin,

I do think there is no way out without installation.
Thankyou though for your response. Will be closing this thread now.

Prashant Talele

If you try and convert a PDF back into something editable, it doesn't become a proper "document" -- it becomes a disorganized salad of ungrouped elements in arbitrary, absolute positions. This is because PDF's are, more or less, just low-level printer instructions. "draw letters abc in position xy at rotation z with font u" sort of thing, nothing like a word processor file.

In other words, it's not that lpr "supports pdf" and "doesn't support word" -- more like, "you must translate anything and everything to printer-speak (PDF, PCL, PS, et cetera) before the printer will accept it".

Nobody has a magic way to make this happen. Try and print a .doc file on a Windows machine with no form of word processor installed -- you get errors or just garbage.

First off, Corona688 is of course right. You can't do it without investing some work, but: the two points you raised above can probably be solved with some effort on your part.

1) Most UNIX systems have a "printing system" where you can plug in "print preprocessors" in form of scripts. If you can get some automatic "word-format to PDF"-converter it is conceivable to write a script to automate this conversion process, plug that into the printer queues processing and this way have "automatic word format printing".

2) no. Regardless of what the software will be (there are perhaps more lightweight options than LibreOffice to convert to PDF) you will need to install it. Depending on your system "installation" is probably just one single command to install a package, but it will be an "installation" anyway. You can perhaps - with finite effort - write your own software directly on the system to convert Word format to PDF - it is perhaps more effort than to even reinstall the whole system several times.

Btw.: right now you have told us nothing about your system (OS, version, ....). How are we suppposed to help you if we not even know which system we deal with?

I hope this helps.

bakunin