title: Programmatically change page in PDF.js with QWebEngineView
body: <p>I am making an application in PyQt5 that involves displaying a PDF using the <code>QWebEngineView</code> and <code>PDF.js</code> by Mozilla.</p>
  <p>I am able to display the PDF no problem, but I cannot figure out how to either:</p>
  <ul>
  <li>1: set the page on load, or</li>
  <li>2: update the page after it is already loaded</li>
  </ul>
  <p>I have tried the numerous options from other Stackoverflow posts that involve using <code>self.runJavaScript()</code> to change it, but it always results in either &quot;Cannot set property  of undefined&quot; or &quot;Object is NoneType&quot;.</p>
  <p>Here is my method:</p>
  <pre><code>def load_file(self, file, page=0) -&gt; None:
          url = QtCore.QUrl().fromLocalFile(os.path.abspath(&quot;./pdfjs/web/viewer.html&quot;))
          query = QtCore.QUrlQuery()
          query.addQueryItem(&quot;file&quot;, os.path.normpath(os.path.abspath(file)))
          url.setQuery(query)
          self.pdf_view.load(url)
  </code></pre>
  <p>where <code>self.pdf_view</code> is QWebEngineView.</p>
  <p>I would appreciate any help on how to accomplish this.</p>
  <p>EDIT: I was able to specify the page on load with the <code>#</code> symbol, but as for changing the page without re-loading the whole thing is still unknown to me.</p>