I'm successfully converting HTML to PDF (or print to pdf). However, Cookies and Privacy Policy notices are printed at the bottom of each page. How do I remove this notice or accept cookies? (solutions for any website domain)
import os
import sys
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
def html_to_pdf(html, pdf):
app = QtWidgets.QApplication(sys.argv)
page = QtWebEngineWidgets.QWebEnginePage()
def handle_print_finished(filename, status):
print("finished", filename, status)
QtWidgets.QApplication.quit()
def handle_load_finished(status):
if status:
page.printToPdf(pdf)
else:
print("Failed")
QtWidgets.QApplication.quit()
page.pdfPrintingFinished.connect(handle_print_finished)
page.loadFinished.connect(handle_load_finished)
page.setUrl(QtCore.QUrl(html))
app.exec_()
if __name__ == "__main__":
html_to_pdf("https://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag?rq=1", "test.pdf")