1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| class Html_vers_pdf_fiche_prof():
def __init__(self, niv_de_classe, nbre_seances, titre_prog, num_seq, incitation, demande, notions_abordees, \
consignes, contraintes, entree_principal_programme, questionnement, que_vont_app_les_elev, \
l_champ_pratiqu_plast, l_question_dens, l_vocabulaire, l_questions, nbre_ref_art, l_ref_art, \
l_comp_et_pts_chiffres, observations, prolongements_possibles, marge_gauche, marge_haute, \
marge_droite, marge_basse, police_normaux_caracteres, police_petits_caracteres, chemin_nom_pdf_final):
super(Html_vers_pdf_fiche_prof, self).__init__()
...
self.html_total = html_entete + html_tab_ligne_0 + html_tab_ligne_1 + html_tab_ligne_2 + html_tab_ligne_3 + html_tab_ligne_4 + html_tab_ligne_5 + html_tab_ligne_6 + html_tab_ligne_7 + html_tab_ligne_8 + html_tab_ligne_9 + html_tab_ligne_10 + html_tab_ligne_11 + html_tab_ligne_12 + html_tab_ligne_13 + html_tab_ligne_14 + html_tab_ligne_15 + html_tab_ligne_16 + html_tab_ligne_17 + html_tab_ligne_18 + html_tab_ligne_19 + html_tab_ligne_20 + html_tab_ligne_21 + html_tab_ligne_22 + html_tab_ligne_23 + html_tab_ligne_24 + html_tab_ligne_25 + html_tab_ligne_26 + html_tab_ligne_27 + html_body_html_final
...
options = {'encoding': 'UTF-8', 'page-size': 'A4', 'orientation':'Portrait', 'footer-right': '[page]', 'footer-line':'', 'footer-font-size':'10', 'footer-spacing':'2', 'footer-left': niv_de_classe+'ème '+titre_prog+' '+'SEQ'+num_seq, 'header-center': 'Séquence réalisée par '+nom_prof+", professeur d'arts plastiques au "+college+', en utilisant '+logiciel_nom+'.', 'header-spacing':'1', 'header-font-size': '7', 'margin-top': str(marge_haute)+'mm', 'margin-left': str(marge_gauche)+'mm', 'margin-right': str(marge_droite)+'mm', 'margin-bottom': str(marge_basse)+'mm'}
if sys.platform == "win32" :
capt = CaptureWkhtmltopdfWindows()
chem_wkhtmltopdf = capt.capture()
config = pdfkit.configuration(wkhtmltopdf=chem_wkhtmltopdf)
pdfkit.from_string(self.html_total, chemin_nom_pdf_final, configuration=config, options=options)
elif sys.platform == 'linux' :
pdfkit.from_string(self.html_total, chemin_nom_pdf_final, options=options) |