Skip to content
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

Multi-cell hyperlink with Markdown followed by \n #916

Closed
mariostg opened this issue Sep 5, 2023 · 2 comments
Closed

Multi-cell hyperlink with Markdown followed by \n #916

mariostg opened this issue Sep 5, 2023 · 2 comments

Comments

@mariostg
Copy link

mariostg commented Sep 5, 2023

Regarding this example : https://py-pdf.github.io/fpdf2/Links.html#hyperlink-with-fpdfmulti_cell

If I use a \n after website like so:

from fpdf import FPDF

pdf = FPDF()
pdf.set_font("helvetica", size=24)
pdf.add_page()
pdf.multi_cell(
    pdf.epw,
    txt="**Website:**\n[fpdf2](https://py-pdf.github.io/fpdf2/) __Go visit it!__",
    markdown=True,
)
pdf.output("hyperlink.pdf")

txt is rendered as expected, but the following does not work as expected; the link is not rendered and the new line neither. See \n just after the link

from fpdf import FPDF

pdf = FPDF()
pdf.set_font("helvetica", size=24)
pdf.add_page()
pdf.multi_cell(
    pdf.epw,
    txt="**Website:** [fpdf2](https://py-pdf.github.io/fpdf2/)\n__Go visit it!__",
    markdown=True,
)
pdf.output("hyperlink.pdf")

Environment
Mac OSX
Python version: 3.11.1
fpdf2 2.7.5

@Lucas-C
Copy link
Member

Lucas-C commented Sep 5, 2023

Thank you @mariostg for reporting this bug!

I opened #917 to fix it

@Lucas-C Lucas-C closed this as completed in 6e3334f Sep 5, 2023
@Lucas-C
Copy link
Member

Lucas-C commented Sep 5, 2023

It's fixed, but not released yet.

You can test it by installing fpdf2 from git, this way:

pip install git+https://github.com/py-pdf/fpdf2.git@master

Also, as a workaround in the meantime, you can simply insert a space before the \n character

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants