Latest Coloring Pages

from fpdf import FPDF
Import os

# Create custom class for notebook
class ColoringBook(FPDF):
    def header(self):
        self.set_font("Arial", "B", 16)
        self.cell(0, 10, "Tru in the Clear Water - Coloring Notebook", ln=True, align="C")
        self.ln(5)

def chapter_title(self, title):
        self.set_font("Arial", "B", 14)
        self.set_text_color(30, 30, 120)
        self.cell(0, 10, title, ln=True)
        self.ln(2)

def chapter_body(self, text):
        self.set_font("Arial", "", 12)
        self.set_text_color(0)
        self.multi_cell(0, 8, text)
        self.ln()

def add_illustration_page(self, title, text, image_path=None):
        self.add_page()
        self.chapter_title(title)
        self.chapter_body(text)
        if image_path and os.path.exists(image_path):
            self.image(image_path, x=30, w=150)
        else:
            self.set_font("Arial", "I", 12)
            self.cell(0, 10, "(Space for drawing and coloring)", ln=True, align="C")

# Create Workbook Instance
pdf = ColoringBook()
pdf.set_auto_page_break(auto=True, margin=15)

# Page Information
pages = [
    {
        "title": "Page 1 – Tru, the little fish",
        "text": "Tru is a happy little fish.\nIt has colored scales: pink, light blue and silver.\nIt lives in a large lake with very clear water."
    },
    {
        "title": "Page 2 – Tru's Home",
        "text": "The lake is in a place with large white mountains.\nThe snow melts and goes down the river to the lake.\nThe sun shines in the sky and there are soft clouds."
    },
    {
        "title": "Page 3 – Tru's Friends",
        "text": "Tru swims with his friends: other fish, a green frog and a red crab.\nThey play among the stones, the plants in the water and the bubbles."
    },
    {
        "title": "Page 4 – The caretakers of the lake",
        "text": "Near the lake there are people who take great care of the place.\nThey work with suits and helmets, and look at the water carefully.\nPapa Fish says that they take care of the lake and give delicious and natural food."
    },
    {
        "title": "Page 5 – Tru grows healthy and strong",
        "text": "Tru eats well, swims much, and grows strong.\nThe lake is clean, the animals are healthy, and everything is quiet."
    },
    {
        "title": "Page 6 – A special place",
        "text": "Tru lives in a special place.\nEverything is natural, clean and beautiful.\nAnd he's a very happy little fish!"
    },
]

# Add the pages to the PDF
for page in pages:
    pdf.add_illustration_page(page["title"], page["text"])

# Save PDF
pdf.output("Tru_en_el_agua_clara_cuaderno_para_colorear.pdf")

From fpdf import fpdf import os # create custom class for notebook class coloringbook(fpdf): def header(self): self.set font("arial", "b", 16) self.cell(0, 10, "tru in the clear water - coloring notebook", ln=true, align="c") self.ln(5) def chapter title(self, title): self.set font("arial", "b", 14) self.set text color(30, 30, 120) self.cell(0, 10, title, ln=true) self.ln(2) def chapter body(self, text): self.set font("arial", "", 12) self.set text color(0) self.multi cell(0, 8, text) self.ln() def add illustration page(self, title, text, image path=none): self.add page() self.chapter title(title) self.chapter body(text) if image path and os.path.exists(image path): self.image(image path, x=30, w=150) else: self.set font("arial", "i", 12) self.cell(0, 10, "(space for drawing and coloring)", ln=true, align="c") # create workbook instance pdf = coloringbook() pdf.set auto page break(auto=true, margin=15) # page information pages = [ { "title": "page 1 – tru, the little fish", "text": "tru is a happy little fish.\nit has colored scales: pink, light blue and silver.\nit lives in a large lake with very clear water." }, { "title": "page 2 – tru's home", "text": "the lake is in a place with large white mountains.\nthe snow melts and goes down the river to the lake.\nthe sun shines in the sky and there are soft clouds." }, { "title": "page 3 – tru's friends", "text": "tru swims with his friends: other fish, a green frog and a red crab.\nthey play among the stones, the plants in the water and the bubbles." }, { "title": "page 4 – the caretakers of the lake", "text": "near the lake there are people who take great care of the place.\nthey work with suits and helmets, and look at the water carefully.\npapa fish says that they take care of the lake and give delicious and natural food." }, { "title": "page 5 – tru grows healthy and strong", "text": "tru eats well, swims much, and grows strong.\nthe lake is clean, the animals are healthy, and everything is quiet." }, { "title": "page 6 – a special place", "text": "tru lives in a special place.\neverything is natural, clean and beautiful.\nand he's a very happy little fish!" }, ] # add the pages to the pdf for page in pages: pdf.add illustration page(page["title"], page["text"]) # save pdf pdf.output("tru en el agua clara cuaderno para colorear.pdf")