3

I know that there n number of question in stackoverflow which is about this same issue, but i didn't get what i was looking for. I even tried using jwordconvert.jar from Qoppa software, but alas !!! it said

Unable to execute dex: Java heap space
Conversion of dalvik format failed.

Now i have seen an app in android market, thats name as Word To Pdf from ThinkTI.com.br. It just did what i want my program to do.

So can anyone tell me about the mechanism behind this application or a similar or better way to do it....

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
  • 1
    Related: http://stackoverflow.com/questions/3022376/how-to-convert-ms-doc-to-pdf/3022553 - Have you tried all the libraries in the post? – Michael Lloyd Lee mlk Aug 10 '12 at 13:24
  • 2
    That's because that JAR is no Android JAR. Android's JVM is a custom one, so it is not "pure" Java. And your question is too broad. You need 2 libraries for this: one to be able to read Word documents and one to write PDF documents. IIRC both formats are open, so you can write those libraries yourself. – m0skit0 Aug 10 '12 at 13:25
  • With both formats are open (ish) neither format is easy. Plus can't you just dump Java JARs in a lib folder and the build tool will convert for you (assuming the JAR does not require something the Dalvik VM does not support)? – Michael Lloyd Lee mlk Aug 10 '12 at 13:47
  • When are you getting the heap space exception, compile time or run time? If compile time see: http://stackoverflow.com/questions/5943712/conversion-to-dalvik-format-failed-unable-to-execute-dex-java-heap-space – Michael Lloyd Lee mlk Aug 10 '12 at 13:48
  • This link will help you ... [https://github.com/plutext/docx4j](https://github.com/plutext/docx4j) – Hemantvc Sep 27 '12 at 05:10

1 Answers1

2

Disclosure: I work on docx4j

docx4j can produce PDF output; see ConvertOutPDF.java

If that quality is acceptable for your purposes, then you can use the docx4j Android build. See jaxb-can-be-made-to-run-on-android

You'll still need to give Java enough heap space; as per the blog post, to give Eclipse more heap space (symptom is ‘you get Unable to execute dex: Java heap space’) edit eclipse.ini, with something like:

-Xms256m

-Xmx4096m
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84