Skip to content

Integrate preview with other web applications

You can integrate the OpenKM web preview module into other web applications quickly.

Advantages:

  • Quick integration into an iframe in your own web application.
  • All OpenKM MIME types supported by the preview modules.
  • Can be used without logging into OpenKM.
  • Can preview documents that are not in OpenKM.

Preview parameters:

Parameter Type Description
docUrl String The full URL of a document.
We recommend using it for all file types.
swfUrl String The full URL of a .swf file.
dxfUrl String The full URL of a .dxf file.
dwfUrl String The full URL of a .dwf file.
htmUrl String The full URL of a .html file.
codUrl String The full URL of a code file, for example .java, .php, etc.
mpgUrl String The full URL of a .mp4 or .mp3 file.
pdfUrl String The full URL of a PDF document. Required by PDF.js previewer.
file String The full URL of a PDF document. Required by PDF.js previewer.
previewEngine String The type of preview to be used by the server. By default it is PDF.js, but with this parameter you can force Flexpaper.
OpenKM supports Flexpaper and PDF.js as PDF previewers

Code sample

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document Preview</title>
</head>
<body>
<div align="left">
Left panel
</div>
<div align="right">
Preview panel<br />
<iframe src="http://localhost:8080/openkm/preview?docUrl=http://localhost/test.pdf"
style="width:800px; height:600px" frameborder="0" marginwidth="0" marginheight="0" />
</div>
</body>
</html>