title: Convert PDF to HTML via PyMuPDF
body: <p>For pages with tabular data in landscape format, the words in the HTML outcome overlap. For pages in portrait formats, the conversion is succesful. Any ideas how to fix that?</p>
  <p>[Here is an example with the converted pdf to html in landscape format]
  [1]: <a href="https://i.stack.imgur.com/twbzw.png" rel="nofollow noreferrer">https://i.stack.imgur.com/twbzw.png</a>
  [2]: <a href="https://i.stack.imgur.com/Ln56P.png" rel="nofollow noreferrer">https://i.stack.imgur.com/Ln56P.png</a></p>
  <pre><code>import ntpath
  from pathlib import Path
  import fitz
  
  doc = fitz.open(in_path)  # open document
  out = open(in_path + &quot;.html&quot;, &quot;wb&quot;)  # open text output
  for page in doc:  # iterate the document pages
      page.read_contents()
      text = page.get_text('html', clip = None).encode(&quot;utf8&quot;)  
      out.write(text)  # write text of page
      out.write(bytes((12,)))  # write page delimiter (form feed 0x0C)
  out.close()
  </code></pre>