{"id":500,"date":"2020-09-05T10:10:44","date_gmt":"2020-09-05T00:10:44","guid":{"rendered":"https:\/\/www.docx4java.org\/blog\/?p=500"},"modified":"2021-09-25T16:03:10","modified_gmt":"2021-09-25T06:03:10","slug":"office-pptxxlsxdocx-to-pdf-to-in-docx4j-8-2-3","status":"publish","type":"post","link":"https:\/\/www.docx4java.org\/blog\/2020\/09\/office-pptxxlsxdocx-to-pdf-to-in-docx4j-8-2-3\/","title":{"rendered":"Office pptx\/xlsx\/docx to PDF to in docx4j 8.2.3"},"content":{"rendered":"<p>docx4j 8.2.3 facilitates 3 distinct ways to convert Microsoft Word docx documents to PDF. There are also possibilities for converting pptx or xlsx to PDF.<\/p>\n<p>The three approaches:<\/p>\n<ul>\n<li><strong>export-fo<\/strong>: the content is converted to XSL FO, and from there, to PDF (or any of the other formats supported by Apache FOP)<\/li>\n<li><strong>documents4j<\/strong>: since 8.2.0, use Microsoft Word to do the conversion<\/li>\n<li><strong>via-Microsoft-Graph<\/strong>: new in 8.2.3, use <a href=\"https:\/\/github.com\/plutext\/java-docx-to-pdf-using-Microsoft-Graph\">java-docx-to-pdf-using-Microsoft-Graph<\/a> to do the conversion<\/li>\n<\/ul>\n<p>So which should you choose? The following table covers some of the things you might want to consider:<\/p>\n<table border=\"1\" style=\"table-layout: fixed; width: 100%\">\n<colgroup>\n<col span=\"1\" style=\"width: 19%;\">\n<col span=\"1\" style=\"width: 27%;\">\n<col span=\"1\" style=\"width: 27%;\">\n<col span=\"1\" style=\"width: 27%;\">\n    <\/colgroup>\n<tr>\n<th style=\"text-align: right;\"><\/th>\n<th style=\"text-align: center;\">export-FO<\/th>\n<th style=\"text-align: center;\">Microsoft Graph<\/th>\n<th style=\"text-align: center;\">documents4j<\/th>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Overview<\/td>\n<td style=\"text-align: center;\">Conversion of docx to XSL FO, then uses Apache FOP to convert to PDF<\/td>\n<td style=\"text-align: center;\">Uses Microsoft&#8217;s cloud<\/td>\n<td style=\"text-align: center;\">Uses your Microsoft Office installation&nbsp;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Fidelity<\/td>\n<td style=\"text-align: center;\">Suitable for simple documents (text, tables, supported image types, header\/footers)<\/td>\n<td style=\"text-align: center;\">100% (Microsoft&#8217;s fidelity)<\/td>\n<td style=\"text-align: center;\">100% (Microsoft&#8217;s fidelity)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Suitability<\/td>\n<td style=\"text-align: center;\">simple docx<\/td>\n<td style=\"text-align: center;\">docx, pptx, xlsx<\/td>\n<td style=\"text-align: center;\">docx, pptx, xlsx<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">License considerations<\/td>\n<td style=\"text-align: center;\">ASL v2<\/td>\n<td style=\"text-align: center;\">Refer applicable Microsoft cloud terms<\/td>\n<td style=\"text-align: center;\">Refer Microsoft EULA governing your Office install&nbsp;<br \/>(increasingly restricted with each release)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Cost<\/td>\n<td style=\"text-align: center;\">Free<\/td>\n<td style=\"text-align: center;\">Microsoft cloud costs<\/td>\n<td style=\"text-align: center;\">(Microsoft Office)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Confidentiality<\/td>\n<td style=\"text-align: center;\">documents don&#8217;t leave your server<\/td>\n<td style=\"text-align: center;\">documents go to Microsoft cloud<\/td>\n<td style=\"text-align: center;\">documents need not leave your servers<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Other advantages<\/td>\n<td style=\"text-align: center;\">&#8211; Fast XSL FO\/PDF templating for high volume PDF creation<br \/>&#8211; Open source, so can be extended<\/td>\n<td style=\"text-align: center;\">&#8211; Microsoft encourages this approach<br \/>&#8211; Microsoft cloud handles scalability<\/td>\n<td style=\"text-align: center;\">&#8211; Can update a docx table of contents<br \/>&#8211; Can convert RTF and binary .doc<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: right;\">Other disadvantages<\/td>\n<td style=\"text-align: center;\">Two step (docx to XSL FO to PDF) processing is slower (except for XSL FO templating)<\/td>\n<td style=\"text-align: center;\">&#8211; Dependency on 3rd party cloud<br \/>&#8211; Currently can&#8217;t update docx table of contents<br \/><a href=\"https:\/\/microsoftgraph.uservoice.com\/forums\/920506-microsoft-graph-feature-requests\/suggestions\/41235295-docx-to-pdf-file-conversion-update-table-of-conte\">vote to fix<\/a><\/td>\n<td style=\"text-align: center;\">&#8211; Not supported by Microsoft<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>docx4j 8.2.3 facilitates 3 distinct ways to convert Microsoft Word docx documents to PDF. There are also possibilities for converting pptx or xlsx to PDF. The three approaches: export-fo: the content is converted to XSL FO, and from there, to PDF (or any of the other formats supported by Apache FOP) documents4j: since 8.2.0, use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104,71],"tags":[],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-docx-to-pdf","category-microsoft-word"],"_links":{"self":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/500","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=500"}],"version-history":[{"count":16,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/500\/revisions"}],"predecessor-version":[{"id":521,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/500\/revisions\/521"}],"wp:attachment":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/media?parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/categories?post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/tags?post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}