| 6 | from src.config import Config |
| 7 | |
| 8 | class PDF: |
| 9 | def __init__(self): |
| 10 | config = Config() |
| 11 | self.pdf_path = config.get_pdfs_dir() |
| 12 | |
| 13 | def markdown_to_pdf(self, markdown_string, project_name): |
| 14 | html_string = markdown(markdown_string) |
| 15 | |
| 16 | out_file_path = os.path.join(self.pdf_path, f"{project_name}.pdf") |
| 17 | with open(out_file_path, "wb") as out_file: |
| 18 | pisa_status = pisa.CreatePDF(html_string, dest=out_file) |
| 19 | |
| 20 | if pisa_status.err: |
| 21 | raise Exception("Error generating PDF") |
| 22 | |
| 23 | return out_file_path |
no outgoing calls
no test coverage detected