Convert docx to pdf

497 views
Skip to first unread message

KunalC

unread,
Jul 7, 2009, 4:05:51 AM7/7/09
to JODConverter
We have situation where we need to convert docx to pdf. We are using
OOo 2.0.4 service, jodconverter 2.2.1. Thing is while trying to
convert a docx file to pdf its coming up with an
illegalArgumentException for the formed URL. We tried using
DocumentFormat for docx but this doesn't seems to be working.

Can I have some leads on this?

Thanks

Alexis Perrier

unread,
Jul 7, 2009, 4:24:46 AM7/7/09
to jodcon...@googlegroups.com
Hi
I had a similar problem but was able to process docx files using latest version of OpenOffice 3.xx and JodConverter 3.0.beta
Hope it helps
Alexis
--
Alexis Perrier
Web Consultant & Project Manager
31 rue Pierre Semard 75009 Paris France
Mobile : +33(0)660 480 142
Blog : http://www.darjeelink.com
Twitter : http://twitter.com/alexip

Mirko Nasato

unread,
Jul 7, 2009, 7:13:47 AM7/7/09
to jodcon...@googlegroups.com
That's right OOo 2.x can't open docx, you need OOo 3.x.

Kind regards

Mirko

2009/7/7 Alexis Perrier <alexis....@gmail.com>:
Message has been deleted

Mirko Nasato

unread,
Jul 8, 2009, 3:32:51 AM7/8/09
to jodcon...@googlegroups.com
Hi hemant joshi,

2009/7/7 hemant joshi <hema...@gmail.com>:
> I am presently using OOo 3 and jodconvertor 2.2.2 and m trying to convert
> docx file to pdf.It is still not converting ,wat exactly in nutshell
> happening is , it picks up document format from defaultdocumentRegistery for
> docx file and call convert method of DocumentConverter which internally
> calls method convertInternal() of StreamOpenOfficeDocumentConverter class
> there it throws exception saying "URL seems to be an unsupported one" .
>
Try using OpenOfficeDocumentConverter instead of
StreamOpenOfficeDocumentConverter. It may be that OOo is not able to
detect the docx file type with streams.

Kind regards

Mirko

Message has been deleted

Mirko Nasato

unread,
Jul 8, 2009, 4:12:46 PM7/8/09
to jodcon...@googlegroups.com
Hi hemant joshi,

2009/7/8 hemant joshi <hema...@gmail.com>:
>
> I have used OpenOfficeDocumentConvertor but still i need to override
> DefaultDocumentFormatRegistry .I did something like this
>
>        final DocumentFormat doc = new DocumentFormat("MS Word 2007
> XML", DocumentFamily.TEXT, "application/msword", "docx");
>        doc.setExportFilter(DocumentFamily.TEXT, "MS Word 2007 XML");
>        addDocumentFormat(doc);
> In DefaultDocumentFormatRegistry  u guys are not setting the
> ExportFilter,so because of that i was getting null for my input
> format.Now after overridng it ,i am able to convert docx document to
> pdf .
>
The docx format in DefaultDocumentFormatRegistry is correct and
working. There's no setExportFilter() because OOo can't export to
docx, only import it. You must have had a different problem.

> Now issue is if my docx document contains images then it converts it
> to pdf but doesn't include the images.
>
> So can i have some pointers on this.
>
See answer #4 of the FAQ

http://code.google.com/p/jodconverter/wiki/FAQ

Kind regards

Mirko

Message has been deleted

Mirko Nasato

unread,
Jul 9, 2009, 3:50:42 AM7/9/09
to jodcon...@googlegroups.com
Hi Hemant,

2009/7/9 hemant joshi <hema...@gmail.com>:
>
>   I have gone through the link which you have given.I have opened my
> docx document which has images also in it with OOo, it preserves my
> all images in document when it is opened.
>
I can convert docx files just fine. Please attach/upload your document
somewhere.

If your document has linked images that are only available on your
machine, and you're converting on another machine, then of course
images will be missing.

Kind regards

Mirko

Message has been deleted

Mirko Nasato

unread,
Jul 9, 2009, 6:29:33 AM7/9/09
to jodcon...@googlegroups.com
Hemant,

2009/7/9 hemant joshi <hema...@gmail.com>:
> Please find the attached docx document which i am trying to
> convert.Images inside this document are not available on my machine.
>
Works fine here and online, the PDF includes images.

http://www.artofsolving.com/online-document-converter

Kind regards

Mirko

Bill

unread,
Jul 14, 2009, 11:06:42 PM7/14/09
to JODConverter
I'm having the same problem Joshi was having:

org.artofsolving.jodconverter.office.OfficeException: could not load
document: testpageMac2008.docx
at org.artofsolving.jodconverter.AbstractConversionTask.loadDocument
(AbstractConversionTask.java:94)
at org.artofsolving.jodconverter.AbstractConversionTask.execute
(AbstractConversionTask.java:62)
at org.artofsolving.jodconverter.office.PooledOfficeManager$2.run
(PooledOfficeManager.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:613)
Caused by: com.sun.star.lang.IllegalArgumentException: URL seems to be
an unsupported one.
at
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException
(Job.java:182)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:148)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter
(JobQueue.java:344)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter
(JobQueue.java:313)
at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter
(JavaThreadPool.java:101)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest
(java_remote_bridge.java:652)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.invoke(ProxyFactory.java:136)
at $Proxy4.loadComponentFromURL(Unknown Source)
at org.artofsolving.jodconverter.AbstractConversionTask.loadDocument
(AbstractConversionTask.java:92)
... 8 more

This works fine with the same document in ".doc" format, both Word for
Mac 2004 and Word for Mac 2008. This is jodconverter3-beta-3, with OO
3.0.1, on OS X 10.5.7. My code looks like:

openoffice = "/Applications/OpenOffice.org.app/Contents";
officeManager = new DefaultOfficeManagerConfiguration()
.setOfficeHome(openoffice)
.setTaskExecutionTimeout(30000L)
.buildOfficeManager();
officeManager.start();
(new OfficeDocumentConverter(officeManager)).convert(file,
tempfile);

I tried your web-based converter, and it converts there, just fine,
too. So it must be something in my code...

Bill

On Jul 9, 3:29 am, Mirko Nasato <mirko.nas...@gmail.com> wrote:
> Hemant,
>
> 2009/7/9 hemant joshi <heman...@gmail.com>:> Please find the attached docx document which i am trying to

Bill

unread,
Jul 14, 2009, 11:14:27 PM7/14/09
to JODConverter
I installed OpenOffice 3.1, and my problem went away...

Bill

Mirko Nasato

unread,
Jul 15, 2009, 3:33:26 AM7/15/09
to jodcon...@googlegroups.com
2009/7/15 Bill <bill.j...@gmail.com>:

>
> I installed OpenOffice 3.1, and my problem went away...
>
Yep installing the latest OOo version should always be the first thing
to try... I'll add a sticky message on top of this group.

Kind regards

Mirko

Reply all
Reply to author
Forward
0 new messages