Spaces:
Runtime error
Runtime error
David Chuan-En Lin
commited on
Commit
•
041ed15
1
Parent(s):
92e18ce
update some formatting, links, images
Browse files- README.md +9 -3
- example.png +0 -0
- app.py → pdf2preview.py +10 -3
README.md
CHANGED
@@ -4,18 +4,24 @@ emoji: 📄
|
|
4 |
colorFrom: purple
|
5 |
colorTo: purple
|
6 |
sdk: streamlit
|
7 |
-
app_file:
|
8 |
---
|
9 |
|
10 |
# PDF ➡️ Preview
|
11 |
|
12 |
A simple tool to save me time on Illustrator. Generates a preview image for a PDF file. Useful for sneak peeks to academic publications on project websites or presentation slides.
|
13 |
|
14 |
-
![Example](example.png)
|
15 |
|
16 |
---
|
17 |
|
18 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
1. Clone the repository.
|
21 |
|
|
|
4 |
colorFrom: purple
|
5 |
colorTo: purple
|
6 |
sdk: streamlit
|
7 |
+
app_file: pdf2preview.py
|
8 |
---
|
9 |
|
10 |
# PDF ➡️ Preview
|
11 |
|
12 |
A simple tool to save me time on Illustrator. Generates a preview image for a PDF file. Useful for sneak peeks to academic publications on project websites or presentation slides.
|
13 |
|
14 |
+
![Example](/Users/david/Home/CMU/Notes/images/example-6133654.png)
|
15 |
|
16 |
---
|
17 |
|
18 |
+
## Try it out!
|
19 |
+
|
20 |
+
http://pdf2preview.chuanenlin.com
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## Setting up
|
25 |
|
26 |
1. Clone the repository.
|
27 |
|
example.png
CHANGED
app.py → pdf2preview.py
RENAMED
@@ -56,17 +56,20 @@ hide_streamlit_style = """
|
|
56 |
<style>
|
57 |
MainMenu {visibility: hidden;}
|
58 |
footer {visibility: hidden;}
|
59 |
-
* {font-family: Avenir;
|
|
|
60 |
.css-gma2qf {display: flex; justify-content: center; font-size: 36px; font-weight: bold;}
|
61 |
a:link {text-decoration: none;}
|
62 |
a:hover {text-decoration: none;}
|
63 |
.st-ba {font-family: Avenir;}
|
|
|
64 |
</style>
|
65 |
"""
|
66 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
67 |
st.title("PDF ➡️ Preview")
|
|
|
68 |
|
69 |
-
col1, col2 = st.columns([1,
|
70 |
with col1:
|
71 |
st.radio("Pick a layout", ("Unroll", "Stack", "Cover"), key="mode")
|
72 |
with col2:
|
@@ -93,4 +96,8 @@ if st.session_state.file is not None:
|
|
93 |
output = io.BytesIO()
|
94 |
preview.save(output, format="PNG")
|
95 |
output = output.getvalue()
|
96 |
-
|
|
|
|
|
|
|
|
|
|
56 |
<style>
|
57 |
MainMenu {visibility: hidden;}
|
58 |
footer {visibility: hidden;}
|
59 |
+
* {font-family: Avenir;}
|
60 |
+
h1 {text-align: center;}
|
61 |
.css-gma2qf {display: flex; justify-content: center; font-size: 36px; font-weight: bold;}
|
62 |
a:link {text-decoration: none;}
|
63 |
a:hover {text-decoration: none;}
|
64 |
.st-ba {font-family: Avenir;}
|
65 |
+
.st-button {text-align: center;}
|
66 |
</style>
|
67 |
"""
|
68 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
69 |
st.title("PDF ➡️ Preview")
|
70 |
+
st.markdown("Generate a preview image for your PDF file.")
|
71 |
|
72 |
+
col1, col2 = st.columns([1, 5])
|
73 |
with col1:
|
74 |
st.radio("Pick a layout", ("Unroll", "Stack", "Cover"), key="mode")
|
75 |
with col2:
|
|
|
96 |
output = io.BytesIO()
|
97 |
preview.save(output, format="PNG")
|
98 |
output = output.getvalue()
|
99 |
+
b1, b2, b3 = st.columns([1, 1, 1])
|
100 |
+
with b2:
|
101 |
+
download = st.download_button(label="Download image", data=output, file_name="pdf2preview.png", mime="image/png")
|
102 |
+
|
103 |
+
st.markdown("By [David Chuan-En Lin](https://chuanenlin.com). Play with the code at https://github.com/chuanenlin/pdf2preview.")
|