Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added pdf stylying #396

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading