title: Extract images from PDF file with JavaScript
body: <p>I want to write JavaScript code to extract all image files from a PDF file, perhaps getting them as JPG or some other image format. There is already some JavaScript code for reading a PDF file, for example in the PDF viewer <a href="https://github.com/mozilla/pdf.js/blob/master/web/viewer.js" rel="noreferrer">pdf-js</a>.</p>
  
  <pre><code>window.addEventListener('change', function webViewerChange(evt) {
    var files = evt.target.files;
    if (!files || files.length === 0)
      return;
  
    // Read the local file into a Uint8Array.
    var fileReader = new FileReader();
    fileReader.onload = function webViewerChangeFileReaderOnload(evt) {
      var buffer = evt.target.result;
      var uint8Array = new Uint8Array(buffer);
      PDFView.open(uint8Array, 0);
    };
  
    var file = files[0];
    fileReader.readAsArrayBuffer(file);
    PDFView.setTitleUsingUrl(file.name);
    ........
  </code></pre>
  
  <p>Can I use this code to help read and extract the image files?</p>