Bug 121501 - writer_pdf_Export can't be used in sdk DocumentConverter.java example
Summary: writer_pdf_Export can't be used in sdk DocumentConverter.java example
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
6.1.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-18 21:09 UTC by JS Lair
Modified: 2020-02-07 18:28 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JS Lair 2018-11-18 21:09:40 UTC
I installed LibreOffice [LibreOffice 6.1.3.2 10(Build:2)] and sdk on Ubuntu 16.03.

I used the java sample DocumentConverter in the sdk package to convert an odt in different formats.

With "MS WORD 97" or "Text" there is no problem but with "writer_pdf_Export" it ends in Exception


For example with odt to MS Word 97 (OK):


java -jar /home/js/libreoffice6.1_sdk/LINUXexample.out/class/JavaDocumentHandlingExamples/DocumentConverter.jar "./test" "MS WORD 97" "doc" "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files"
Connected to a running office ...

The converted documents will stored in "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files!
[test]
   test1.odt


and for odt to pdf (OK):

java -jar /home/js/libreoffice6.1_sdk/LINUXexample.out/class/JavaDocumentHandlingExamples/DocumentConverter.jar "./test" "writer_pdf_Export" "pdf" "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files"
Connected to a running office ...

The converted documents will stored in "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files!
[test]
com.sun.star.task.ErrorCodeIOException: SfxBaseModel::impl_store <file:////home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files/test1.pdf> failed: 0x81a(Error Area:Io Class:Parameter Code:26)
    at   com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:158)
    at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:122)
    at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:312)
    at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:281)
    at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:81)
    at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:618)
    at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:145)
    at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:129)
    at com.sun.proxy.$Proxy5.storeAsURL(Unknown Source)
    at DocumentConverter.traverse(DocumentConverter.java:137)
    at DocumentConverter.main(DocumentConverter.java:216)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.star.lib.loader.Loader.main(Loader.java:132)
  test1.odt


What's more unoconv using Python interface can convert to pdf!

I need to use the UNO interface through java to convert to any format, and I really need pdf also... Any help?
Comment 1 JS Lair 2018-11-18 21:47:42 UTC
I tested the export of the test1.odt example file with different filters, and here is the result:

OK:writer8_template
OK:writer8
OK:UOF text
OK:Text (encoded)
OK:Text
OK:Rich Text Format
OK:OpenDocument Text Flat XML
OK:Office Open XML Text
OK:MS Word 97
OK:MS Word 2007 XML
OK:MS Word 2003 XML
OK:HTML (StarWriter)
OK:DocBook File

KO:writer_pdf_Export
KO:writer_StarOffice_XML_Writer_Template
KO:XHTML Writer File
KO:StarWriter 5.0 Vorlage/Template
KO:StarWriter 5.0
KO:StarWriter 4.0 Vorlage/Template
KO:StarWriter 4.0
KO:StarWriter 3.0 Vorlage/Template
KO:StarWriter 3.0
KO:StarOffice XML (Writer)
KO:PocketWord File
KO:MediaWiki
KO:MS_Works
KO:MS Word 95
KO:MS WinWord 6.0
KO:LaTeX_Writer
KO:BibTeX_Writer
KO:AportisDoc Palm DB

The same test with unoconv is able to export also to writer_pdf_Export, MediaWiki and XHTML Writer File
Comment 2 Xisco Faulí 2018-11-19 10:09:21 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
else confirms it.
Comment 3 Xisco Faulí 2019-07-08 15:51:29 UTC
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 4 QA Administrators 2020-01-05 03:49:13 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2020-02-05 03:37:38 UTC Comment hidden (obsolete)
Comment 6 apil.tamang 2020-02-05 19:46:56 UTC
I was able to recreate the issue exactly, on my MacOS.

Here is my prepared SDK env:

************************************************************************
 *
 * SDK environment is prepared for MacOSX
 *
 * SDK = /Users/admin/LibreOffice6.4_SDK
 * Office = /Applications/LibreOffice.app
 * Make = /usr/bin
 * Zip = /usr/bin
 * cat = /bin
 * sed = /usr/bin
 * C++ Compiler = /usr/bin
 * Java = /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home
 * SDK Output directory = /Users/admin/LibreOffice6.4_SDK
 * Auto deployment = YES
 *
 ************************************************************************

OS X version 10.15.1
Downloaded SDK: LibreOffice_6.4.0_MacOS_x86-64_sdk

To reproduce:
1) Download and install the SDK on your platform (6.4.0 for me on OS X)

2) Build the example in SDK_HOME/examples/java/DocumentHandling using "make" command

3) Create folder called "/Users/admin/samples" and copy "test/test1.odt" inside there.

4) Navigate to the build directory 
 and run:

java -Dcom.sun.star.lib.loader.unopath="/Applications/LibreOffice.app/Contents/MacOS" -jar DocumentConverter.jar "/Users/admin/samples" "writer_pdf_Export" "pdf" "/Users/admin/samples"

 And you should see the exact exception trace that this ticket was initially created for.
Comment 7 apil.tamang 2020-02-07 17:16:09 UTC
I suppose this ticket can be closed.

The solution was to use edit the "DocumentConverter.java" file to use the "xStorable.saveToUrl(..)" api to export test.odt to test.pdf.

I will try and see if I can open a pull request with this example.