PDF preview

preview pdf document on your KB question page

0e5bb68f83c4db3e4b036c09db528f85

Written by Haris Delalic

Last published at: January 8th, 2019

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>


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

<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.