Skip to content

Commit

Permalink
Merge pull request #396 from assafelovic/feature/pdf_style
Browse files Browse the repository at this point in the history
added pdf stylying
  • Loading branch information
assafelovic authored Mar 18, 2024
2 parents 42df071 + 554eaf8 commit 5f7dd5c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def write_md_to_pdf(text: str) -> str:
md2pdf(f"{file_path}.pdf",
md_content=None,
md_file_path=f"{file_path}.md",
css_file_path=None,
css_file_path="./frontend/pdf_styles.css",
base_url=None)
print(f"Report written to {file_path}.pdf")
except Exception as e:
Expand Down
53 changes: 53 additions & 0 deletions frontend/pdf_styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
body {
font-family: 'Libre Baskerville', serif;
font-size: 12pt; /* standard size for academic papers */
line-height: 1.6; /* for readability */
color: #333; /* softer on the eyes than black */
background-color: #fff; /* white background */
margin: 0;
padding: 0;
}

h1, h2, h3, h4, h5, h6 {
font-family: 'Libre Baskerville', serif;
color: #000; /* darker than the body text */
margin-top: 1em; /* space above headers */
}

h1 {
font-size: 2em; /* make h1 twice the size of the body text */
}

h2 {
font-size: 1.5em;
}

/* Add some space between paragraphs */
p {
margin-bottom: 1em;
}

/* Style for blockquotes, often used in academic papers */
blockquote {
font-style: italic;
margin: 1em 0;
padding: 1em;
background-color: #f9f9f9; /* a light grey background */
}

/* You might want to style tables, figures, etc. too */
table {
border-collapse: collapse;
width: 100%;
}

table, th, td {
border: 1px solid #ddd;
text-align: left;
padding: 8px;
}

th {
background-color: #f2f2f2;
color: black;
}

0 comments on commit 5f7dd5c

Please sign in to comment.