Spaces:
Sleeping
Sleeping
Commit
·
abb0a92
1
Parent(s):
0889af8
PDF Render Issue Revert to embed
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from base64 import b64encode
|
|
5 |
from fpdf import FPDF
|
6 |
import io, string, re, math
|
7 |
from io import StringIO
|
|
|
8 |
|
9 |
# Importing the Fastify Class
|
10 |
from fast_reader import Fastify_Reader
|
@@ -84,8 +85,14 @@ with tab1:
|
|
84 |
base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
|
85 |
|
86 |
# Embedding the PDFs in the HTML
|
87 |
-
original_display = f'<
|
88 |
-
pdf_display = f'<
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
# original_display = f"""
|
91 |
# <div class="pdf-container" style="height: 500px;">
|
@@ -97,6 +104,7 @@ with tab1:
|
|
97 |
# <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style="width: 100%; height: 100%;">
|
98 |
# </div>
|
99 |
# """
|
|
|
100 |
# Compare Logic implementation
|
101 |
if compare:
|
102 |
col1, col2, col3 = st.columns(3)
|
@@ -154,10 +162,15 @@ with tab2:
|
|
154 |
base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
|
155 |
|
156 |
# Embedding the PDFs in the HTML
|
|
|
|
|
|
|
|
|
157 |
# original_display = f"""<embed class="pdfobject" type="application/pdf" title="Original PDF" src="data:application/pdf;base64,{original_pdf}" style=" width: 100%; height: 150%;">"""
|
158 |
# pdf_display = f"""<embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style=" width: 100%; height: 150%;">"""
|
159 |
-
|
160 |
-
|
|
|
161 |
|
162 |
# original_display = f"""
|
163 |
# <div class="pdf-container" style="height: 500px;">
|
|
|
5 |
from fpdf import FPDF
|
6 |
import io, string, re, math
|
7 |
from io import StringIO
|
8 |
+
from streamlit_pdf_viewer import pdf_viewer
|
9 |
|
10 |
# Importing the Fastify Class
|
11 |
from fast_reader import Fastify_Reader
|
|
|
85 |
base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
|
86 |
|
87 |
# Embedding the PDFs in the HTML
|
88 |
+
original_display = f'<embed src="data:application/pdf;base64,{original_pdf}" width = "100%" height = 600 type="application/pdf" download="original.pdf">'
|
89 |
+
pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width = "100%" height = 600 type="application/pdf" download="Modified.pdf">'
|
90 |
+
|
91 |
+
# original_display = f"""<embed class="pdfobject" type="application/pdf" title="Original PDF" src="data:application/pdf;base64,{original_pdf}" style=" width: 100%; height: 150%;">"""
|
92 |
+
# pdf_display = f"""<embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style=" width: 100%; height: 150%;">"""
|
93 |
+
|
94 |
+
# original_display = f'<iframe src="data:application/pdf;base64,{original_pdf}" width = "100%" height = 600 type="application/pdf" download="original.pdf"></iframe>'
|
95 |
+
# pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width = "100%" height = 600 type="application/pdf" download="Modified.pdf"></iframe>'
|
96 |
|
97 |
# original_display = f"""
|
98 |
# <div class="pdf-container" style="height: 500px;">
|
|
|
104 |
# <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style="width: 100%; height: 100%;">
|
105 |
# </div>
|
106 |
# """
|
107 |
+
|
108 |
# Compare Logic implementation
|
109 |
if compare:
|
110 |
col1, col2, col3 = st.columns(3)
|
|
|
162 |
base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
|
163 |
|
164 |
# Embedding the PDFs in the HTML
|
165 |
+
original_display = f'<embed src="data:application/pdf;base64,{original_pdf}" width = "100%" height = 600 type="application/pdf" download="original.pdf">'
|
166 |
+
pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width = "100%" height = 600 type="application/pdf" download="Modified.pdf">'
|
167 |
+
|
168 |
+
|
169 |
# original_display = f"""<embed class="pdfobject" type="application/pdf" title="Original PDF" src="data:application/pdf;base64,{original_pdf}" style=" width: 100%; height: 150%;">"""
|
170 |
# pdf_display = f"""<embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style=" width: 100%; height: 150%;">"""
|
171 |
+
|
172 |
+
# original_display = f'<iframe src="data:application/pdf;base64,{original_pdf}" width = "100%" height = 600 type="application/pdf" download="original.pdf"></iframe>'
|
173 |
+
# pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width = "100%" height = 600 type="application/pdf" download="Modified.pdf"></iframe>'
|
174 |
|
175 |
# original_display = f"""
|
176 |
# <div class="pdf-container" style="height: 500px;">
|