I have generated a PDF using PyQt5 which is working perfectly fine. Am just looking to have a border spacing, unable to do that using layouts. Below is the code,
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
def printhtmltopdf(html_in, pdf_filename):
app = QtWidgets.QApplication([])
page = QtWebEngineWidgets.QWebEnginePage()
def handle_pdfPrintingFinished(*args):
print("finished: ", args)
app.quit()
def handle_loadFinished(finished):
page.printToPdf(pdf_filename)
page.pdfPrintingFinished.connect(handle_pdfPrintingFinished)
page.loadFinished.connect(handle_loadFinished)
page.setZoomFactor(1)
page.setHtml(html_in)
app.exec()
printhtmltopdf(
result, # raw html variable
"file.pdf",
)
Result is,
Expected result is as below having spaces in the beginning and end of the content. Basically i need to have a padding on left, right, top and bottom
Any suggestion will be appreciated