title: Convert pdf to image before uploading it to s3
body: <p>I have a current setup in React js where I upload files to s3 using multipart upload as buffer.However if the file format is pdf,video,audio etc. I want to convert it to image before uploading to s3; think of it as thumbnail generation.I have read a lot about this but could not find a right solution for my needs, can please someone suggest some possible solution?(where backend is not involved at all) 
  PS:I have looked at pdf.js but dont know how to use it while my file type is buffer and what type will it return and can I upload it the same way to S3.A small example  would help miles. Thanks in advance !!</p>
  
  <pre><code>    var pdfData = buffer;
      var pdfjsLib = window['pdfjs-dist/build/pdf'];
  
      pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.worker.min.js';
  
      var loadingTask = pdfjsLib.getDocument({data: pdfData});
      loadingTask.promise.then(function(pdf) {
          console.log('PDF loaded');
          pdf.getPage(1).then(function getPageHelloWorld(page) {
  
              var scale = 1.5;
              var viewport = page.getViewport(scale);
              console.log('page',viewport);
              //
              // Prepare canvas using PDF page dimensions
              //
              var canvas = document.getElementById('bulk-thumbnails');
              var context = canvas.getContext('2d');
              canvas.height = viewport.height;
              canvas.width = viewport.width;
  
              //
              // Render PDF page into canvas context
              //
              page.render({canvasContext: context, viewport: viewport});
          });
  </code></pre>