0% found this document useful (0 votes)
36 views1 page

Creating Tsadf

The document outlines a Python script using the fpdf2 library to generate multiple PDF files. It describes a function that creates three separate PDFs, each with 25 pages containing sample text. Additionally, it mentions customization options for fonts and styles within the PDFs.

Uploaded by

jaivion.zared
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views1 page

Creating Tsadf

The document outlines a Python script using the fpdf2 library to generate multiple PDF files. It describes a function that creates three separate PDFs, each with 25 pages containing sample text. Additionally, it mentions customization options for fonts and styles within the PDFs.

Uploaded by

jaivion.zared
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

pdf.

set_font('Times', '', 12)

for j in range(40): # Adjust number of lines per page as needed

pdf.cell(0, 10, f'This is line {j+1} on page {i+1}.', 0, 1)

# Save the PDF

pdf.output('book1.pdf')

3. Generate Multiple PDFs:

To create three separate PDFs, you can encapsulate the above code into a function and call
it with different filenames:

def create_pdf(filename):

pdf = PDF()

for i in range(25):

pdf.add_page()

pdf.set_font('Times', '', 12)

for j in range(40):

pdf.cell(0, 10, f'This is line {j+1} on page {i+1}.', 0, 1)

pdf.output(filename)

# Generate three PDFs

create_pdf('book1.pdf')

create_pdf('book2.pdf')

create_pdf('book3.pdf')

This script will produce three PDFs named book1.pdf, book2.pdf, and book3.pdf, each
containing 25 pages with sample text.

Customization:

• Fonts and Styles: fpdf2 supports various fonts and styles. You can customize the
font type, size, and style as needed.

You might also like