mubi-613 commited on
Commit
b5acd54
·
1 Parent(s): f5daa20

Replace the font

Browse files
Files changed (1) hide show
  1. vault_logic.py +3 -4
vault_logic.py CHANGED
@@ -155,7 +155,6 @@ def create_pdf(title, content):
155
  pdf.add_font('DejaVu', '', font_path, uni=True)
156
  pdf.set_font('DejaVu', '', 14)
157
  else:
158
- # This is where it was falling back before, causing the "?" symbols
159
  pdf.set_font("Arial", "B", 16)
160
 
161
  # Write Title
@@ -166,14 +165,14 @@ def create_pdf(title, content):
166
  if os.path.exists(font_path):
167
  pdf.set_font('DejaVu', '', 12)
168
  else:
169
- pdf.set_font("Arial", "", 12)
170
 
171
  pdf.multi_cell(0, 10, content)
172
 
173
  # Output as bytes
174
- return pdf.output(dest='S').encode('latin-1')
175
  except Exception as e:
176
- return f"PDF Error: {str(e)}".encode('latin-1')
177
 
178
  def create_docx(title, content):
179
  doc = Document()
 
155
  pdf.add_font('DejaVu', '', font_path, uni=True)
156
  pdf.set_font('DejaVu', '', 14)
157
  else:
 
158
  pdf.set_font("Arial", "B", 16)
159
 
160
  # Write Title
 
165
  if os.path.exists(font_path):
166
  pdf.set_font('DejaVu', '', 12)
167
  else:
168
+ pdf.set_font("helvetica", "", 12)
169
 
170
  pdf.multi_cell(0, 10, content)
171
 
172
  # Output as bytes
173
+ return pdf.output(dest='S').encode('utf-8')
174
  except Exception as e:
175
+ return f"PDF Error: {str(e)}".encode('utf-8')
176
 
177
  def create_docx(title, content):
178
  doc = Document()