Responsive HTML web pages are the ones that look good on different devices by adjusting themselves according to the different screen sizes. This article will guide you about how to programmatically convert word documents as responsive HTML pages within the Java applications using GroupDocs.Viewer.
The following topics will be covered below:
Java API – Convert & View Word Docs as Responsive HTML
GroupDocs.Viewer provides the Java API to render the Word documents as responsive HTML pages within Java applications. This Java API allows to render, display, and manipulate a large number of different document formats. It further allows building HTML Viewer with external as well as embedded resources, an Image Viewer by rendering as JPG and PNG, and also the PDF Viewer that could be best for printing or sharing with others.
Download or Configure
You may download the JAR file from the downloads section, or just get the latest repository and dependency configurations for the pox.xml of your maven-based Java applications.
<repository> <id>GroupDocsArtifactRepository</id> <name>GroupDocs Artifact Repository</name> <url>https://repository.groupdocs.com/repo/</url> </repository>
<dependency> <groupId>com.groupdocs</groupId> <artifactId>groupdocs-viewer</artifactId> <version>21.4</version> </dependency>
Convert Word Documents to View as Responsive HTML using Java
You can render your MS Word DOC, DOCX documents, to responsive HTML pages to look good on all the different screen sizes. The following steps show how to convert a Word document (DOC/DOCX) to responsive HTML in Java.
- Load the Word document (DOC/DOCX) using the Viewer class.
- Set either the embedded or external resources for the html output using HtmlViewOptions.
- Enable the responsive rendering using setRenderResponsive method.
- To generate the responsive webpages of the loaded Word document, use the view method of the Viewer class
The following source code renders the Word document as responsive HTML with embedded resources in Java.
Get a Free API License
You can get a free temporary license to use the API without the evaluation limitations.
To conclude, you discussed how to render the Word documents as responsive HTML pages within Java applications using GroupDocs.Viewer for Java API. Additionally, you can generate these HTML pages with either embedded or external resources. You must think about starting building your own document viewer application in Java like the one already built by GroupDocs.