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)