Search code examples
javascriptjspthumbnailspdf.jspdf.js.express

How to display PDF thumbnails in JSP pages


I tried to use the following js, but it didn't seem feasible. PDF.js 'Hello, world!' example

How can I fix it?

function dispPhoto(file,suffix) {
  var $thumbArea = $('#thumbnail'+suffix);
  $thumbArea.empty();
  $('#fileName'+suffix).html( "" );
  $('#MSG_SHOKEN'+suffix).html("");

  if(!file || !file.type.match(/^image\/(jpeg|jpg|jpe|png)$|application\/pdf/)) {
    return false;
  }

  var isPdf = Boolean(file.type.match(/application\/pdf/));

  var reader = new FileReader();
  if (isPdf) {
     /*
      *
      */
  }

Solution

  • convert ES6 to Es5 and use the character-set which you want