-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to convert HTML style tags inside fpdf paragraphs? #498
Comments
Hi @me-suzy |
@all-contributors please add @me-suzy for bug |
I've put up a pull request to add @me-suzy! 🎉 |
PR #499 fixed this You can test it by installing the latest
|
This has been broken since at least v2.2.0 of |
@me-suzy: no need to install You need to have the
This is the syntax to install a Python package from a |
In the error it says that you have not installed git. https://phoenixnap.com/kb/how-to-install-git-windows You do these steps to Launch Git GUI (exclusive). Open Git Bash. Then go to the Configure GitHub Credentials step and run the 2 commands with your GitHub account data.
After doing that you run the command given by those guys. And then you run the PDF converter. |
Yes, I installed everything successfully, but it still looks the same. This is the html paragraph with The basic tag doesn't see in PDF, very good. But the italic tag
See the PDF after running Python code: |
The following code works perfectly fine for me with the latest version of from fpdf import fpdf, html
class PDF(fpdf.FPDF, html.HTMLMixin):
pass
pdf = PDF()
pdf.add_page()
pdf.add_font("Kanit", fname="fonts/Kanit-Regular.ttf")
pdf.add_font("Kanit", style="I", fname="fonts/Kanit-Italic.ttf")
pdf.set_font("Kanit", size=24)
pdf.write_html('<p class="text_obisnuit2"><em>Pentru a cunoaşte realitatea un lider trebuie să deţină şi arta disimulării – o armă de temut, dar eficientă în cele mai multe situaţii.</em></p>')
pdf.output("issue_498.pdf") The Kanit font is a Google font: https://fonts.google.com/specimen/Kanit The resulting PDF contains text in italics: issue_498.pdf If you have further issues, please share some fully-autonomous minimal reproducible example so that we can replicate your problem. |
I copy/paste my complete code on the link below. I also write the errors that I encountered |
Hi!
I have several HTML tags inside the paragraphs I'm writing to the pdf file.
Those HTML tags contain some style I want to apply to the text I am writing.
Let's consider this example:
My name is Emily.
<em>Hello world!<em>
My name is Jon. (in pdf file)Normally, on the HTML page this text is displayed like this (
<em>
tags transform the text into italic):My name is Emily. Hello world! My name is Jon. (on HTML page)
Is there any way to annotate the text, such that it will be displayed italic in the pdf, instead of ?
So, basicaly, I need to change the second style contained in a HTML tag. For example:
<p class="soft">I love design very much because it represent <em>the month december</em> that its winter time.</p>
must be visible in adobe as:
I love design very much because it represent the month december that its winter time.
The text was updated successfully, but these errors were encountered: