Microsoft-Word To PDF Conversion using JNA in Ubuntu

57 views
Skip to first unread message

Anbalagan G

unread,
Apr 3, 2021, 1:52:11 PM4/3/21
to Java Native Access
Hi JNA Group Members,
               Am working on word document to pdf conversion using JPA, this concept working fine on windows environment by using office's dll, but in Linux like OS's environment it won't, it gives below error,

<pre>java.lang.UnsatisfiedLinkError: Unable to load library &#39;Ole32&#39;:
&#47;src\docLibrary\libole32.so: cannot open shared object file: No such file or directory
&#47;lib&#47;x86_64-linux-gnu&#47;libOle32.so: wrong ELF class: ELFCLASS32
Native library (linux-x86-64&#47;libOle32.so) not found in resource path
com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:317)
com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:477)
com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:192)
com.sun.jna.Native.load(Native.java:598)
com.sun.jna.platform.win32.Ole32.&lt;clinit&gt;(Ole32.java:50)
And i have searched how to make .dll to .so to make it run, unfortunately i did'nt get enough content..

Please help me to do in linux like os..
THANKS IN ADVANCE..
     

Durchholz, Joachim

unread,
Apr 4, 2021, 2:53:23 AM4/4/21
to jna-...@googlegroups.com

Hi A,

 

Your approach won’t work, there is no ole32.dll in any operating system other than Windows (not 100% true, see below).

The error message is talking about libole32.so but that’s just the name of ole32 if it did exist in Linux.

 

Fortunately, there are Java libraries for reading Word and for writing PDF, just search for

            Java read word files

(or similar search terms) to find them.

You usually get one or two library names for this kind of stuff; do some more internet searches to find out which of these libraries are useful, and what the pitfalls are.

 

Regards,

Jo

 

You can have ole32.dll on Linux if the user has set up a Windows-y environment like Wine or a Windows VM.

With that kind of setup, you don’t need to port to Linux at all, but you’re burdening your users with setting up such an environment, which isn’t trivial – plus the minor differences between a normal Windows and one that runs inside Windows may give you support requests that are harder to solve.

--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jna-users/fab43ec8-7b1f-4675-9e00-210167fd061dn%40googlegroups.com.

 

Sensitivity: C2 Internal

The content of this e-mail is intended only for the confidential use of the person addressed.
If you are not the intended recipient, please notify the sender and delete this e-mail immediately.
Thank you.

Tres Finocchiaro

unread,
Apr 14, 2021, 1:25:21 AM4/14/21
to jna-...@googlegroups.com
Not JNA related, but unoconv can do an OK job and can be invoked by Java from command line if available: https://askubuntu.com/a/398499/412004

Reply all
Reply to author
Forward
0 new messages