Spaces:
Running
Running
File size: 867 Bytes
32a7233 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 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)
|