Page 1 of 1

Able to open docx with MSWord but cannot convert to PDF

PostPosted: Fri May 29, 2015 8:08 pm
by vyongjay
Hi again!

Thank you for your help last time.

I could manage to export the docx finally. I opened it from ms word 2013 ,and the formation was perfect! :D

However, when I tried to convert to pdf with FO. (from this example https://github.com/plutext/docx4j/blob/ ... utPDF.java)

There was a problem with null pointer exception.
I tried some more things but none worked.

Then I went to some other commercial pdf converter product and tried the free demo. Just want to know what was wrong.
They also couldn't convert my docx.
The error thrown would be informative to investigate : it said "Can't add attribute to 0-length text"

Well, now, I have completely blinded. So I tried open the docx with MS Word again. Put some word to make change and saved.
Now I can convert it!
I think there's some problem with my table and image in document. It may caused by wrong use of API or anything else I couldn't guess.

I almost gave up and think that user may be able to use another docx reader/viewer in case they don't own ms word. So I headed on finding any free docx reader and d/l it, install then open my generated docx. Bang! the docx could be opened, but all image and table were gone. Just the header and footer, and some headlines.

Now I'm already desperate. So I have to come and ask you again. really hesitate to do this :(

Could you please see the structure of my document.xml whether or not I need to put anything extra tag or what I did wrong? (I could post the code but I think it would be quite long. From your expert view, you may find my newob mistake quickly from the xml structure, I guess)

Anyway, this is a fantastic API! Thanks for your hard work to make this world the better place ^^

Re: Able to open docx with MSWord but cannot convert to PDF

PostPosted: Mon Jun 01, 2015 7:46 pm
by jason
Works for me with current docx4j source code.

What does the NPE you are getting say?