from reportlab.platypus import SimpleDocTemplate doc = SimpleDocTemplate("example.pdf")
from reportlab.lib.pagesizes import letter from reportlab.lib import styles doc = SimpleDocTemplate("example.pdf", pagesize=letter, leftMargin=72, rightMargin=72, topMargin=72, bottomMargin=72, title="My Document") doc.styles = styles.getSampleStyleSheet()In this example, a new `SimpleDocTemplate` instance is created with a file name `"example.pdf"`. The document template is customized with a letter-sized page, 1 inch margins on all sides, and a title "My Document". The `styles` module is also imported and the default document styles are added to the `styles` attribute of the `doc` instance. Package Library: reportlab