CodeBuddyAI / agent /tools /PDF.py
TahaFawzyElshrif
uploaded files
32a7233
raw
history blame contribute delete
867 Bytes
from markdown_pdf import MarkdownPdf, Section
import os
#### For this version the nodes used directly not by graph
format_css = """
body {
font-family: 'Amiri', 'Arial', sans-serif; /* ุฎุท ูŠุฏุนู… ุนุฑุจูŠ ูˆุงู†ุฌู„ูŠุฒูŠ */
font-size: 12pt;
line-height: 1.6;
direction: rtl; /* ู„ุฌุนู„ ุงู„ู†ุต ู…ู† ุงู„ูŠู…ูŠู† ู„ู„ูŠุณุงุฑ */
margin: 20px;
}
h1, h2, h3 {
color: #2E86C1;
margin-bottom: 10px;
}
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 10px;
}
table, th, td {
border: 1px solid #555;
padding: 6px;
}
th {
background-color: #f0f0f0;
}
"""
def PDF_generator_Node(text_md,text_title,path_pdf):
pdf = MarkdownPdf(toc_level=2)
pdf.add_section(Section("# "+text_title), user_css=format_css)
pdf.add_section(Section(text_md), user_css=format_css)
pdf.save(path_pdf)