Relative Content

Tag Archive for pythonhtmlselenium-webdriverpdf

Converting HTML to PDF using selenium causes bookmarks to break

I am using selenium in Python to try and convert HTML files to PDF. Everything converts perfectly except bookmark links. The issue is consistent for all HTML files I’ve tried, and the exact issue is that the first 2 bookmarks in the PDF send you to almost the correct location but always slightly off, and then the rest always send you to the bottom of the pdf. These bookmarks do work correctly in the HTML.
Originally, I was attempting to convert a large file and I thought the issue was that things were not loaded so I used seleniums WebDriverWait to make sure everything was loaded but that did not solve the problem.