automated, scripts, shell

Batch convert RTF to PDF

You’ve got the full details here (the OpenOffice Forum site). After following the instructions there, I was able to convert a bunch of some 500 rtf files into pdf’s with the following single ‘line of code’ (although there must be a newline after the first quote ')

$ find /Users/pedrofortunyayuso/Desktop/fichitas -name "*rtf" | while read -r i ; do 
/Applications/ -invisible 
"macro:///Standard.MyConversions.SaveASPDF($i)" ; done 

All the above shows my computer as an evident OS X, but this works on Windows (the referred site does the job on Windows, using, obviously a different shell construct) and, as far as I know, on Linux. Notice that you (this should be obvious now) need OpenOffice or NeoOffice, and that the path to the executable will certainly vary.
The details are simple enough but require you to create a macro named “SaveASPDF” in a “MyConversions” module inside the Standard OpenOffice (or NeoOffice, as in the example) macro bundle.
It was quite useful to me. Read the details if you need to do something similar.
[NB: This has been edited following pgas‘ piped-while suggestion. There was a for loop with the find inside inverted quotes:

$ for i in `find . .....` 

But the while does not require loading the whole list into memory at once.]

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*Required Fields