Improve preview of MS Office documents

Help us to improve OpenKM! Be part of the Open Source Community.
Forum rules
Please, before asking something see the documentation wiki or use the forum search function.
Post Reply
mkwong98
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 27, 2015 6:21 am

Improve preview of MS Office documents

Post by mkwong98 » Mon Oct 26, 2015 5:37 am

Hi, as the generation of pdf for preview is not 100% accurate, I suggest modifying the MS Add-on to generate the preview pdf if the MS Office support it and upload it at the same time as the document itself. I also suggest allowing the user to manually upload a preview pdf too. This way, it is possible to by pass the inaccurate preview pdf generation and use the pdf generated by MS Office. Thank you.

jllort
Moderator
Moderator
Posts: 9374
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Improve preview of MS Office documents

Post by jllort » Wed Oct 28, 2015 7:15 am

The solution you propose will not solve anything ( from openkm side you still need converting pdf to swf ). This topic is the same than another topic you have yet opened, I suggest do not open new topics for same issue and continues with the first opened.

Note: I'm not sure if community version has the option - at profiles - of embeded preview, what will use acrobat reader plugin in browser for previewing and will not cause to you the conversion problem. Take a look on profiles at general tab.

mkwong98
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 27, 2015 6:21 am

Re: Improve preview of MS Office documents

Post by mkwong98 » Wed Oct 28, 2015 10:55 am

The problem that I have is that openoffice/libreoffice cannot render those files accurately to pdf to begin with:

1. the same formatting problem in the preview appears when I open those doc/xls/ppt files with openoffice/libreoffice.
2. pdf files generated by MS office do not have that problem and the preview of those pdf files also do no have the problem.

So the problem happens during the doc/xls/ppt to pdf step, and as far as I can tell, the converting pdf to swf works perfectly. That is why I propose to bypass openoffice/libreoffice if the computer uploading the file already has MS office.

So please reconsider my suggestion, thanks.

pavila
Moderator
Moderator
Posts: 3011
Joined: Tue Dec 11, 2007 6:02 pm
Location: Alicante, Spain
Contact:

Re: Improve preview of MS Office documents

Post by pavila » Thu Oct 29, 2015 8:31 am

According to your proposal, how do we convert Office documents to PDF? The previewer need the document in PDF or SWF format.

mkwong98
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 27, 2015 6:21 am

Re: Improve preview of MS Office documents

Post by mkwong98 » Thu Oct 29, 2015 9:29 am

I suggest two ways of doing it:
1. If it is uploaded using the MS Office add-on then automatically convert it to PDF at the same time as uploading the file
2. Allow the user to manually upload a PDF file to the preview cache

jllort
Moderator
Moderator
Posts: 9374
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Improve preview of MS Office documents

Post by jllort » Fri Oct 30, 2015 7:21 pm

If you want always want to make this conversion, the best option is create an automation action, and each time document is created in openkm, convert to pdf and delete word document. If you have Java skill I can guide on you for doing it.

mkwong98
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Thu Aug 27, 2015 6:21 am

Re: Improve preview of MS Office documents

Post by mkwong98 » Mon Nov 02, 2015 2:52 am

I'll follow the development guide first to install the development tools. It will be great if you can tell me how the source code files are organized. Thank you.

jllort
Moderator
Moderator
Posts: 9374
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Improve preview of MS Office documents

Post by jllort » Tue Nov 03, 2015 7:33 pm

Here are some clues about it:
- You should create an action. Take a look for example the class named OMRDataCapture.java as scheleton for creating new action.
In the logic you should convert any document to pdf ( excepts pdf documents ), take a look at DocConverter.java there's a method named

Code: Select all

doc2pdf(File input, String mimeType, File output)
- You must download the file to server tmp ( take a look at FileUtils.createTempFile()) calling from the method getConted from OKMDocument.java API class:

Code: Select all

public InputStream getContent(String token, String docId, boolean checkout)
token should be null ( then is using user context )
docId can be document uuid or document path
checkout must be false

- From OKMDocument.java you can use other interesting methods like move or delete, etc...

Note: New actions must be registered into database, take a look at:
http://wiki.openkm.com/index.php/Enable_automation
http://wiki.openkm.com/index.php/Extend_automation_6.0
http://wiki.openkm.com/index.php/Automation

OliviaBlogger
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: Sat Jul 23, 2016 12:12 pm
Contact:

Re: Improve preview of MS Office documents

Post by OliviaBlogger » Sat Jul 23, 2016 12:57 pm

Thank you for the instruction. This really was good step.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest