I would like to convert an RTF document to PDF. I know LO can do this but what I would like is the ability for LO to do it from the command line. Is this possible? I am running LO 3.4.4 on Windows XP.
JodConverter is the tool to do it from the command-line
see:
http://code.google.com/p/jodconverter/wiki/GettingStarted
Or just do 'libreoffice --headless --convert-to pdf foo.rtf'.
just tested that (with LO3.3), and it should be:
libreoffice -headless -convert-to pdf foo.rtf
Sorry to sound clueless but I couldn't find a program called
libreoffice.exe on my windows XP pc running LO 3.4.4. Do you mean
soffice.exe?
Hi
Ooops, yes. The name soffice is the one to use. It's left over from about a decade ago when the project forked off from Star Office ;) Hopefully at some point the name will be changed but it's not trivial to do so and doesn't really gain much advantage.
Apols and regards from
Tom
Hi
Hmm, i tried googling about this and some results suggested you might need to use
lowriter
instead of
soffice.exe
or
libreoffice.exe
Regards from
Tom
Why converting one foreign file format to another foreign file format? RTF is
a native MS file format, poorly supported by LibreOffice. On Windows XP you
have the WordPad and you may also install the MS Word Viewer to read RTF,
doc and docx file formats. Then there are several PDF printers for free
download. I can recommend FreePDF. On the command line you might be able
call the MS application with a printer argument to print out the documents
in question to the virtual PDF printer.
I understand where you're coming from but this is something that needs
to fit into an existing batch process on multiple machines that are
creating an RTF from word pad. And portable LO would fit in perfectly
in headless mode. Thanks for the input.
After the Christmas festivities I will give it a try. Thanks for the
guidance. Merry Christmas
I may have missed a few messages in this thread, but I'm not sure. Anyway, I'm wondering what the problem
actually is. If you just want to print the RTF file, LO ver. 3.4.4 does it perfectly, at least for me. Preserves font,
preserves formatting (I receive material that's fully justified, and it maintains that). It appears OK on screen,
and then it prints OK. I just tried converting that file to PDF in LO, opened it with Adobe Reader, and printed it.
It was OK on screen, and it printed perfectly on my LaserJet. In other words, all the operations were perfectly
transparent to the original RTF file, made on a PC with Microsoft (I think--or it could have been made on an
older Mac with Microsoft). I am absolutely sure about the MS source, however.
I am using Libre 3.4.4 on PCLinuxOs, latest upgraded version, KDE 4.6.5, kernel 2.6.38.8.
I don't know what it would do with an image--I don't even know if RTF supports images. But text is no problem.
--doug
Hi
Don't worry. Any time is ok. This thread stays here and you can always
create a new one if it's months or years before you get around to it.
Rtf can hold images. I just did a quick check. Svg, png, gifs were all
fine. I didn't try jpgs. Rtf can't cope with Macros
Microsoft promoted Rtf as a long-lasting format that all sorts of programs
would use. Apparently there was/is a court-case about it. There were
claims that Rtf was too proprietary to the extent that it was difficult for
non-MS programs to integrate updates to the format into their programs. So
instead of being able to be used properly in all programs Rtf was really
limited to MS programs. Crazy huh? MS have stopped developing Rtf so any
current or future security issues or any problems at all will remain
unfixed. MS claim that DocX is "Open" but seem to be making their
implementation of it secret/proprietary.
Now Adobe are promoting their Pdf format as the one format that can be read
the same on any system. It is a proprietary format. It is free as long as
they choose to keep it free but that could change anytime they like. Also
if there are any problems or security issues then we have to rely on Adobe
to fix them.
Rtf to Pdf is a bit like "Out of the frying pan and into the fire". It does
sort things out temporarily but locks you in further. Staying with Rtf
makes more sense. Moving to Odf is the best bet = at least it really is
native to a wide variety of programs and is even supported in MS Office now.
Regards from
Tom
i like bottom-quoting, so you know where to find my reply
Hi
Hmm, i tried googling about this and some results suggested you might need to uselowriter
instead of
soffice.exe
or
libreoffice.exeRegards from
TomFrom: Luuk <luuk34@gmail.com>
Subject: [libreoffice-users] Re: RTF to PDF Command Line
To: users@global.libreoffice.org
Date: Saturday, 24 December, 2011, 11:49JodConverter is the tool to do it from the command-line
see:
http://code.google.com/p/jodconverter/wiki/GettingStartedOr just do 'libreoffice --headless --convert-to pdf foo.rtf'.
just tested that (with LO3.3), and it should be:
libreoffice -headless -convert-to pdf foo.rtf
indeed, in my previous post it said: 'libreoffice', but that should be:
'soffice' (or 'soffice.exe', but this last bit wont work on linux )
Use of 'lowriter' is basiccally the same as 'soffice -writer "$@"'
Hi Luuk
Thanks for clarifying that. It makes more sense now. So the command would
be either
soffice -writer --headless --convert-to pdf file-name.rtf'
or
lowriter --headless --convert-to pdf file-name.rtf'
or on Windows a 3rd way of trying
soffice.exe -writer --headless --convert-to pdf file-name.rtf'
or try the jod converter
http://code.google.com/p/jodconverter/wiki/GettingStarted
Pdf does have advantages. People are unlikely to mess up a document by
editing it because not many people have software that can edit them. Also
documents looks the same on pretty much any system and print the same on
pretty much any printer.
Regards from
Tom
soffice --headless --convert-to pdf file-name.rtf
The option '-writer' is not needed, because an RTF-file will be openend
with writer per-default....
Is however 'strange' that the options on a Windows computer need two
'--' (i.e. --headless), and on linux just need one '-' (i.e. -headless)
Should this not be more standardized?
As far as I remember, options for Windows command-line programs are delimited
by slash (e.g. del /f some_file).
So, either way, LO behavior is non-standard for Windows apps. But, on the
other hand, most of Windows users does not use terminal mode - those who do
perhaps have some experience with Linux shells as well.
You are right, so there are 2 options:
1) Do it the Windows-way, and make LO use the '/' for this stuff.
2) Do it the LO-way, and make sure the parameters are accepted the same
way on every implemented platform.
The on thing I noticed was if I have quickstarter loaded which keeps soffice.bin & soffice.exe loaded in memory this command, /soffice --headless --convert-to PDF document.rtf/ doesn't create the PDF. If I exit quickstarter, which looks to close soffice.bin & soffice.exe, then execute the command the PDF is created. Is there a parameter I'm missing? Also can I specify an output path?
Is however 'strange' that the options on a Windows computer need two
'--' (i.e. --headless), and on linux just need one '-' (i.e. -headless)Should this not be more standardized?
As far as I remember, options for Windows command-line programs are delimited
by slash (e.g. del /f some_file).So, either way, LO behavior is non-standard for Windows apps. But, on the
other hand, most of Windows users does not use terminal mode - those who do
perhaps have some experience with Linux shells as well.
You are right, so there are 2 options:
1) Do it the Windows-way, and make LO use the '/' for this stuff.
2) Do it the LO-way, and make sure the parameters are accepted the same
way on every implemented platform.
Also is there some requirement that would allow the installed version of LO to work and not the portable?
Is however 'strange' that the options on a Windows computer need two
'--' (i.e. --headless), and on linux just need one '-' (i.e. -headless)Should this not be more standardized?
As far as I remember, options for Windows command-line programs are delimited
by slash (e.g. del /f some_file).So, either way, LO behavior is non-standard for Windows apps. But, on the
other hand, most of Windows users does not use terminal mode - those who do
perhaps have some experience with Linux shells as well.
You are right, so there are 2 options:
1) Do it the Windows-way, and make LO use the '/' for this stuff.
2) Do it the LO-way, and make sure the parameters are accepted the same
way on every implemented platform.
Never mind on the portable question. It seems as if it was a bad portable install. but I wild still like to know if I can redirect the PDF on output.
Is however 'strange' that the options on a Windows computer need two
'--' (i.e. --headless), and on linux just need one '-' (i.e. -headless)Should this not be more standardized?
As far as I remember, options for Windows command-line programs are delimited
by slash (e.g. del /f some_file).So, either way, LO behavior is non-standard for Windows apps. But, on the
other hand, most of Windows users does not use terminal mode - those who do
perhaps have some experience with Linux shells as well.
You are right, so there are 2 options:
1) Do it the Windows-way, and make LO use the '/' for this stuff.
2) Do it the LO-way, and make sure the parameters are accepted the same
way on every implemented platform.