Page 1 of 1

HtmltoPdf giving problem for Android

PostPosted: Tue Jan 08, 2013 8:09 pm
by Anjalisethi1980
Hi Jason,
I am working on one of the Android Application DoctoPdf Conversion. I used docx4j for converting doc to html with reference AndroidDocxToHtml . The problem i am facing is ,After converted to Html when i am trying to convert Html into Pdf using fop its giving error:
java.lang.NoClassDefFoundError: org.apache.fop.apps.FopFactory

I added fop jar in libs folder as well but still it was giving the same problem.kindly provide me some information for the using fop on android. it would be really helpful for me.

Anjali

Re: HtmltoPdf giving problem for Android

PostPosted: Wed Jan 09, 2013 10:52 am
by jason
Ordinarily, with docx4j, to get PDF output, you'd convert straight from docx, not via HTML.

The PDF output is a two step process:

1. docx to xslfo
2. xslfo to pdf

Regarding step 1, docx4j uses XSLT + Xalan extension functions. I found running Xalan extension functions on Android is problematic: http://stackoverflow.com/questions/1057 ... on-android

You can workaround this by instead using https://github.com/plutext/docx4j/blob/ ... nXSLT.java

You'll need to copy the relevant code into the android branch sources, and recompile

Step 2 is where FOP is involved. I haven't tried to get FOP working on Android, so I don't know whether there are any issues there. You might want to find out what is involved here, before bothering with step 1.