Thursday, 31 August 2017

Open Office Integration


Liferay has a capability to convert document in different format like pdf, doc...etc. We can convert web content as well as document media content in different format. 

But this feature is not enabled by default. To enable this feature we need to perform some extra steps. 



Consider the below web content and you want to have a link in the content to export as PDF. 

Sample Web Content

To achieve this we can integrate open office in your portal. Once open office is configured we can easily convert any document as well as liferay web content in different formats. 


Below are the few steps to integrate open office in Liferay.

Step 1: Download open office from the site  https://www.openoffice.org 

Step 2: Install open office. 

Step 3: Run the open office service. 

Step 4: Configure Liferay to use open office service. 

Step 5: Enable export option for web content. 

                                              

I have downloaded Apache_OpenOffice_4.1.1_Win_x86_install_en-US.exe. You can download open office according to your machine. (Step 1 is completed)


Install open office in your machine in any drive. I have installed in C:\Program Files (x86)\OpenOffice 4. You can install according to your interest. (Step 2 is completed)


In the Step 3 you have to start the open office service. Navigate to C:\Program Files (x86)\OpenOffice 4\program (In your case it may be different). Run the below command (its a windows command)

soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

(Step 3 is completed)


In step 4 configure Liferay to use this service. To integrate go to your control panel and navigate as shown in below screen shot. 

External Services

Then enable open office as below 

Enable Open Office

(Step 4 is completed)

In Step 5 go to your web content. Click the setting icon or Configuration icon. 

Click the settings icon

                         Check the PDF and Save. 

Enable PDF
Refresh your page. PDF icon will appear in your web content as in the below image. (Step 5 is completed)

PDF icon appeared


Similarly you can convert your documents which are uploaded through document and media portlet. Just open any document from your document and media portlet. You will see different formats to convert a document.