0

I'm using docx4j to convert a microsoft word document into a pdf then displaying it in a browser http://www.docx4java.org/trac/docx4j and it works well for a preview. The problem I'm facing is that this conversion loses most of the microsoft word document formatting. Page breaks and fonts don't transfer into the PDF format properly and even though I'm using standard font types docx4j doesn't come with them. In a Linux Tomcat hosted scenario fonts are not found and throw exceptions as it falls back to sans serif or other generic types.

I have found this Microsoft tool to make documents render online, but I'm behind a firewall so I cannot include this tool as an option: https://products.office.com/en-us/office-online/view-office-documents-online

I'm open to suggestion on displaying a docx file as a preview and print option from within a browser. Pdf conversion appears to be the most promising, but I run into formatting issues.

Any ideas are welcome!

JKK
  • 436
  • 2
  • 11
  • 22
  • Note, we found something that may work in addition to the one answer below from qoppa. It appears to make an accurate conversion of word docx files to pdf without losing format or fonts. – JKK Mar 19 '16 at 12:12

2 Answers2

1

Have a play with http://converter-eval.plutext.com/viewer.html

Consider it an alpha level preview. We haven't quite released it yet, but you will be able to host it behind a firewall.

It isn't open source, I'm afraid, and we're still working out pricing (and whether/how there could be a free edition).

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
0

If you only need to render a docx document in a browser, u can use Google Documents Viewer for this as :

<iframe src="http://docs.google.com/gview?url=pathOfDocx&embedded=true" />
Learner
  • 79
  • 5