Skip to content

External preview extension

The External Preview feature helps you preview documents based on an external URL request.

Field / Property Type Description
extension.external.preview List Each row is a pair of values that declare preview content; the format is:
mime-type;url
application/illustrator;http://localhost:8180/openkm/test.jsp
application/epub+zip;http://localhost:8180/openkm/epub\_previewer.jsp
application/x-mspublisher;http://localhost:8180/openkm/mspreviewer\_previewer.jsp
When you embed a URL in an iframe that belongs to a different subdomain from the application’s domain, you must include that domain in the configuration; otherwise, the browser will block it for security reasons. You can find more information about the okm.content.security.policy configuration parameter in the section Experimental configuration parameters

Create a file named test.jsp and copy it to the $TOMCAT_HOME/webapps/openkm folder.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>External URL request example</title>
</head>
<body>
Request parameters
<br />
<br />
<b>uuid:</b><%=request.getParameter("uuid")%><br />
<br />
<b>dowloadUrl:</b><%=request.getParameter("downloadUrl")%><br />
</body>
</html>
  • Choose a document with one of the MIME types set in the configuration parameters.
  • Open the Preview tab. The external URL based on the document’s MIME type will be shown.