Bonjour à tous,
Je développe un appli qui utilise entre autre pdfkit (donc wkhtmltopdf) et je voudrais récupérer les quelques infos délivrées par wkhtmltopdf, je passe par pdfkit, voici un extrait du code :
Voici les infos de wkhtmltopdf délivrées sous GNU/Linux :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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)
... et celles délivrées sous windows :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 Loading pages (1/6) Counting pages (2/6) Resolving links (4/6) Loading headers and footers (5/6) Printing pages (6/6) Done
... notamment les infos sur le pourcentage effectué.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 Loading pages (1/6) [> ] 0% [======> ] 10% QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files [=======> ] 13% [===========> ] 19% [=============> ] 22% [================> ] 28% [===================> ] 32% [====================> ] 34% [======================> ] 37% [=======================> ] 39% [=========================> ] 42% [==========================> ] 44% [============================> ] 47% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [==============================> ] Page 1 of 2 [============================================================] Page 2 of 2 Done
Comment faire ?
a+
Partager