How to join rtf files script linux server?

Asked By 70 points N/A Posted on -
qa-featured

I'm trying to convert hundreds of text files into rtf files in linux.  Is there any way to manipulate Word file using PHP so I can merge multiple doc files?  If so, can you please help me on how to join rtf files script linux server?

SHARE
Best Answer by Jemison Stacy
Answered By 0 points N/A #196225

How to join rtf files script linux server?

qa-featured

Hi John,

To create rtf files in PHP I recommend using the library PHPRtfLite
 
You can open each text file, format it using the library and attach the document you are creating.
add all the text files and finally save a single RTF file.
 
Best regards,
 
Kay Sheri.
Best Answer
Best Answer
Answered By 0 points N/A #196227

How to join rtf files script linux server?

qa-featured

Hi John, I had this task once and while searching on the internet I hardly find a better way. One the possible solution would be the below one. It is a little complex so you have to do carefuly. 1. Download and install JODC Converter and Open Office (if you already have that is great). 2. Start the open office as the server. You can use the following command to do this: soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard 3. Convert rtf or MSWord into ODT by JODCConverter through backticks. 4. Then unzip every file into a temporary directory of its own. 5. Using a DOM Parser reads the contents.xml from every unzipped document. 6. Extract and concatenate the content from each. 7. Put this xml into the right spot in the content.xml file 8. Again unzip the temporary directory and put a .odt ectension 9. Convert these files back to MSWord again by using JOD Converter. Well, this might not be an easy one but this should do the job.

Related Questions