PDF Preview

preview pdf document on your KB question page

Written By Haris Delalic (Administrator)

Updated at May 20th, 2020

In order to have pdf preview on your question page, following has to be added through customization to the top of yours 'Question Page':

<script type="text/javascript">
  $( document ).ready(function() {
  answer = process_answer_using_pdf_preview('{{ question.answers.first.cleaned_body }}');
  document.getElementById("pdf_answer").innerHTML = answer; });

<script type="text/javascript">
  resizeIframe = function(iframe) {
   iframe.height = '700px'
   iframe.width = '700px'

<div id="pdf_answer"></div>

PDF preview box height and width can be changed, in this example both of them are set to 700px.

Also, on the top of pdf preview box comes link to particular document, previewed in box.

PS. do not forget to remove {{ question.answers.first.cleaned_body }} from your question page, since answer will be shown two times unless removed.

Was this article helpful?