{"id":24,"date":"2008-01-13T19:27:31","date_gmt":"2008-01-13T09:27:31","guid":{"rendered":"http:\/\/dev.plutext.org\/blog\/2008\/01\/13\/docx-to-html-or-pdf-using-java\/"},"modified":"2008-02-22T12:06:12","modified_gmt":"2008-02-22T02:06:12","slug":"docx-to-html-or-pdf-using-java","status":"publish","type":"post","link":"https:\/\/www.docx4java.org\/blog\/2008\/01\/docx-to-html-or-pdf-using-java\/","title":{"rendered":".docx to HTML or PDF using Java"},"content":{"rendered":"<p>Doug Mahugh <a href=\"http:\/\/blogs.msdn.com\/dmahugh\/archive\/2008\/01\/11\/open-xml-links-for-01-11-2007.aspx\">recently mentioned<\/a> someone using the DocX2Html.xsl that ships with SharePoint to preview DOCX files in HTML.<\/p>\n<p>As it happens, we&#8217;ve just implemented HTML and PDF output in docx4j using a similar approach.  We&#8217;re using the <span class=\"Head\">earlier WordML2HTML XSLT stylesheet <a href=\"http:\/\/www.xmllab.net\/Downloads\/tabid\/61\/Default.aspx\">available from <\/a><\/span><span class=\"normal\"><a href=\"http:\/\/www.xmllab.net\/Downloads\/tabid\/61\/Default.aspx\">Oleg Tkachenko<\/a>. (It would be great if Microsoft also made the presumably newer <\/span>DocX2Html.xsl that ships with SharePoint freely available).<\/p>\n<p>To create the HTML, we use Sun&#8217;s <a href=\"https:\/\/xhtmlrenderer.dev.java.net\/\">xhtmlrenderer<\/a> (thanks Sun!).  See the obligatory <a href=\"\/trac\/docx4j\/wiki\/TutorialHtml\">tutorial<\/a>.<\/p>\n<p>To create the PDF, we take the HTML, and run it through Sun&#8217;s <a href=\"https:\/\/pdf-renderer.dev.java.net\/\">pdf-renderer<\/a> (thanks again, Sun). And again, the <a href=\"\/trac\/docx4j\/wiki\/TutorialPdf\">tutorial<\/a>.<\/p>\n<p>The icing on the cake is the PDF Viewer which comes with pdf-renderer. That will give us print preview and printing in  docx4all.<\/p>\n<p>Finally, thanks <a href=\"http:\/\/weblogs.goshaky.com\/weblogs\/lars\/entry\/nice_a_100_pure_java\">Lars<\/a> for bringing pdf-renderer to my attention.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Doug Mahugh recently mentioned someone using the DocX2Html.xsl that ships with SharePoint to preview DOCX files in HTML. As it happens, we&#8217;ve just implemented HTML and PDF output in docx4j using a similar approach. We&#8217;re using the earlier WordML2HTML XSLT stylesheet available from Oleg Tkachenko. (It would be great if Microsoft also made the presumably [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97,92],"tags":[15,4,35,34,36],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-docx","category-docx4j","tag-docx","tag-docx4j","tag-html","tag-pdf","tag-xhtml"],"_links":{"self":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":0,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}