akarshrajsingh7 commited on
Commit
1f0f559
·
1 Parent(s): 9e8ba83

PDF Render Issue Fix - Separate Class

Browse files
Files changed (1) hide show
  1. app.py +31 -11
app.py CHANGED
@@ -84,9 +84,16 @@ 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'<iframe src="data:application/pdf;base64,{original_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
88
- pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
89
-
 
 
 
 
 
 
 
90
  # Compare Logic implementation
91
  if compare:
92
  col1, col2, col3 = st.columns(3)
@@ -144,8 +151,21 @@ with tab2:
144
  base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
145
 
146
  # Embedding the PDFs in the HTML
147
- original_display = f'<iframe src="data:application/pdf;base64,{original_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
148
- pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  # Compare Logic implementation
151
  if compare:
@@ -163,12 +183,12 @@ with tab2:
163
  with st.container(border = True):
164
  st.markdown("<div style='text-align: center;'><strong>Fastified PDF viewer</strong></div>", unsafe_allow_html=True)
165
  st.markdown(pdf_display, unsafe_allow_html=True)
166
- # Browser Cache Note
167
- st.markdown(f"""
168
- <div style='background-color: #FFD580; border-radius: 5px;'>
169
- <p style='color: black;'><strong>Note</strong> - {note_text}</p>
170
- </div>
171
- """, unsafe_allow_html=True)
172
  else:
173
  # No Comparison
174
  col1, col2, col3 = st.columns(3)
 
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
+ <div class="pdf-container" style="height: 500px;">
89
+ <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{original_pdf}" style="width: 100%; height: 100%;">
90
+ </div>
91
+ """
92
+ pdf_display = f"""
93
+ <div class="pdf-container" style="height: 500px;">
94
+ <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style="width: 100%; height: 100%;">
95
+ </div>
96
+ """
97
  # Compare Logic implementation
98
  if compare:
99
  col1, col2, col3 = st.columns(3)
 
151
  base64_pdf = b64encode(text_to_pdf_fastify(text)).decode("utf-8")
152
 
153
  # Embedding the PDFs in the HTML
154
+ # original_display = f"""<embed class="pdfobject" type="application/pdf" title="Original PDF" src="data:application/pdf;base64,{original_pdf}" style=" width: 100%; height: 150%;">"""
155
+ # pdf_display = f"""<embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style=" width: 100%; height: 150%;">"""
156
+
157
+ original_display = f"""
158
+ <div class="pdf-container" style="height: 500px;">
159
+ <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{original_pdf}" style="width: 100%; height: 100%;">
160
+ </div>
161
+ """
162
+ pdf_display = f"""
163
+ <div class="pdf-container" style="height: 500px;">
164
+ <embed class="pdfobject" type="application/pdf" title="Modified PDF" src="data:application/pdf;base64,{base64_pdf}" style="width: 100%; height: 100%;">
165
+ </div>
166
+ """
167
+
168
+
169
 
170
  # Compare Logic implementation
171
  if compare:
 
183
  with st.container(border = True):
184
  st.markdown("<div style='text-align: center;'><strong>Fastified PDF viewer</strong></div>", unsafe_allow_html=True)
185
  st.markdown(pdf_display, unsafe_allow_html=True)
186
+ # # Browser Cache Note
187
+ # st.markdown(f"""
188
+ # <div style='background-color: #FFD580; border-radius: 5px;'>
189
+ # <p style='color: black;'><strong>Note</strong> - {note_text}</p>
190
+ # </div>
191
+ # """, unsafe_allow_html=True)
192
  else:
193
  # No Comparison
194
  col1, col2, col3 = st.columns(3)