ajout des caractères cyrilics
This commit is contained in:
parent
10eedffe7d
commit
be1129475e
14
main.py
14
main.py
@ -70,6 +70,9 @@ def create_pdf_from_results(results, output_path):
|
||||
doc = SimpleDocTemplate(output_path, pagesize=letter, topMargin=inch, bottomMargin=inch)
|
||||
story = []
|
||||
|
||||
# Enregistre une police qui supporte le cyrilique
|
||||
font_name = register_unicode_font()
|
||||
|
||||
# Style personnalisé
|
||||
styles = getSampleStyleSheet()
|
||||
title_style = ParagraphStyle(
|
||||
@ -78,7 +81,8 @@ def create_pdf_from_results(results, output_path):
|
||||
fontSize=16,
|
||||
textColor='#1f4788',
|
||||
spaceAfter=0.3*inch,
|
||||
alignment=TA_JUSTIFY
|
||||
alignment=TA_JUSTIFY,
|
||||
fontName=font_name
|
||||
)
|
||||
|
||||
page_style = ParagraphStyle(
|
||||
@ -87,7 +91,8 @@ def create_pdf_from_results(results, output_path):
|
||||
fontSize=12,
|
||||
textColor='#1f4788',
|
||||
spaceAfter=0.2*inch,
|
||||
spaceBefore=0.2*inch
|
||||
spaceBefore=0.2*inch,
|
||||
fontName=font_name
|
||||
)
|
||||
|
||||
body_style = ParagraphStyle(
|
||||
@ -95,7 +100,8 @@ def create_pdf_from_results(results, output_path):
|
||||
parent=styles['BodyText'],
|
||||
fontSize=11,
|
||||
alignment=TA_JUSTIFY,
|
||||
spaceAfter=0.2*inch
|
||||
spaceAfter=0.2*inch,
|
||||
fontName=font_name
|
||||
)
|
||||
|
||||
# Titre
|
||||
@ -123,7 +129,7 @@ def main():
|
||||
|
||||
# Traitement page par page
|
||||
for i, page_text in enumerate(pages, start=1):
|
||||
if( i > 3) : # Limite le nombre de pages pour les tests
|
||||
if( i > 2) : # Limite le nombre de pages pour les tests
|
||||
break
|
||||
print(f"{15 * '-'} Traduction de la page {i}/{len(pages)}...")
|
||||
prompt = f"Traduis le texte suivant de l'ukrainien vers le français : {page_text}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user