• Automatically convert .doc/.docx to .pdf

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #47919  by zaans2
 
Is it possible to set it up so that the following will happen:
  • User uploads Word document to OpenKM
  • Word document gets converted to PDF
  • Converted PDF gets saved alongside the original Word document

Would be even better if the PDF gets converted again of the Word document is updated.

Is this possible? And if so, how?
 #47948  by jllort
 
Is posible create a new document from doc or docx to pdf automatically but is not possible update word document, the reason is that these documents are not the same, the PDF is a new document totally different ( in terms of binary data and mime type ). An option might be, before the corvertion move to the trash automatically.

You should create an automation task for it ( for the conversion , etc.. ):
https://docs.openkm.com/kcenter/view/ok ... ted-).html
in combination with DocConverter.class https://github.com/openkm/document-mana ... erter.java
 #48037  by saulhidalgo
 
Good afternoon.

Yes, It is possible. I would do it using Automated Tasks as recommended in the previous answer.

Regarding if it is possible to convert the PDF again if the Word document is updated, my solution would be to create an automate task associated with the event "Document Update", just delete the PDF (if exists) and convert it again very similarly to what was done in the "Document Create" task.

I hope it helps. In case you need any advice or guide, you can contact me.

Mail: saulhidalgoaular@gmail.com.
Skype: saulhidalgoaular@outlook.com
Phone: +58 426 517 94 59.

Best Regards.
Saul Hidalgo.
 #48324  by zaans2
 
I could use some help with the script. I currently have the following
Code: Select all
import com.openkm.util.*;
import com.openkm.api.*;

String dest = OKMDocument.getInstance().getPath(null, uuid);
DocConverter.doc2pdf(null, uuid,  dest)
But this doesn't work (because getPath returns the entire path, including the filename where I only want the parent folder path).
I also need to check if a document being created is already a PDF document since those don't need to get converted. I have no idea where to start doing that.
 #48344  by jllort
 
The method getProperties will provide you more information:
https://docs.openkm.com/kcenter/view/ok ... Properties

Will be returned a Document object
https://docs.openkm.com/apidoc/com/okm/ ... ument.html
https://docs.openkm.com/apidoc/com/okm/6.3.6/ ( all the classes )

Do you have OpenKM personal development environment, because will be good idea you debug the code. You can find it in the openkm website downloading section https://www.openkm.com/en/download.html

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.