You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on using the part enclosed resets to the start of the td
on using bgcolor the text in the entire page from the start of the first occurence of tr with bg color becomes of the same color
you can ignore the last one, i'll raise that as another later issue if needed Error details
No Exceptions are raised
Minimal code
Please include some minimal Python code reproducing your issue:
fromfpdfimportFPDFfromfpdfimportFPDF, HTMLMixinclassmyPDF(FPDF, HTMLMixin):
passo=myPDF()
o.add_page()
reds, rede="<<REDS>>", "<<REDE>>"##TODO: MAKE CONDITIONAL TO ARGUMENTS greens, greene="<<GREENS>>", "<<GREENE>>"deftoHtml(s1,s2):
res=f"""<tr> <td width="50%">{s1}</td> <td width="50%">{s2}</td> </tr>"""ifredsins1orgreensins2:
res=f"""<tr > <td width="50%">{s1}</td> <td width="50%">{s2}</td> </tr>""".replace(reds,
"<font color=\"red\">"
).replace(rede,
"</font>"
).replace(greens,
"<font color=\"green\">"
).replace(greene,
"</font>"
)
returnrespre_file=f"""this is the {reds}first {rede} line this is the second line this is a really long third {reds} line that i dont know for {rede} some reason goes beyond the page width"""post_file=f"""this is the {greens}first {greene} line this is the second line this is a really long third {greens} line that i dont know for {greene} some reason goes beyond the page width"""pdfFile="".join([toHtml(l1,l2) forl1,l2inzip(pre_file.split('\n'), post_file.split('\n'))])
pdfFile=f"<table>{pdfFile}</table>"o.set_font('helvetica')
o.set_font_size(14)
o.write_html(pdfFile)
o.output("demo2.pdf",)
Environment
OS (Windows, Mac OSX, Linux flavour...): Mac
Python version: 3.9
fpdf2 version used : master branch
The text was updated successfully, but these errors were encountered:
Typically, as mentioned in the docs, multi-lines cells (= automatic line wrapping) are not supported: #91
Do you really need to work with HTML?
Otherwise I would recommend to use the multi_cell() method that will provide automatic line wrapping.
You can also find recipes on building tables in the documentation: https://pyfpdf.github.io/fpdf2/Tables.html
Also, I don't understand this sentence:
on using the part enclosed resets to the start of the td
Describe the bug
you can ignore the last one, i'll raise that as another later issue if needed
Error details
No Exceptions are raised
Minimal code
Please include some minimal Python code reproducing your issue:
Environment
fpdf2
version used : master branchThe text was updated successfully, but these errors were encountered: