From 5b7b6a4eff33a5a300e08276f49c0cb372c01074 Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:40:19 +0100 Subject: [PATCH] Fixing links in table cells - close #1031 (#1033) --- .../continuous-integration-workflow.yml | 4 ++-- docs/Tables.md | 2 +- fpdf/__init__.py | 3 +++ fpdf/table.py | 1 + test/table/table_with_links.pdf | Bin 80555 -> 84485 bytes 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index da6b3d29b..f844b103e 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -24,11 +24,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install system dependencies ⚙️ if: matrix.platform == 'ubuntu-latest' - run: sudo apt-get update && sudo apt-get install ghostscript libjpeg-dev + run: sudo apt-get update --allow-releaseinfo-change && sudo apt-get install ghostscript libjpeg-dev - name: Install qpdf ⚙️ if: matrix.platform == 'ubuntu-latest' && matrix.python-version != '3.9' # We run the unit tests WITHOUT qpdf for a single parallel execution / Python version: - run: sudo apt-get update && sudo apt-get install qpdf + run: sudo apt-get update --allow-releaseinfo-change && sudo apt-get install qpdf - name: Install Python dependencies ⚙️ run: | python -m pip install --upgrade pip setuptools wheel diff --git a/docs/Tables.md b/docs/Tables.md index 9b1406518..10464d212 100644 --- a/docs/Tables.md +++ b/docs/Tables.md @@ -288,7 +288,7 @@ Result: ## Adding links to cells ```python - row.cell(..., link="https://py-pdf.github.io/fpdf2/") +row.cell(..., link="https://py-pdf.github.io/fpdf2/") row.cell(..., link=pdf.add_link(page=1)) ``` diff --git a/fpdf/__init__.py b/fpdf/__init__.py index 977548e24..dc78b10cb 100644 --- a/fpdf/__init__.py +++ b/fpdf/__init__.py @@ -8,6 +8,7 @@ * `fpdf.enums.XPos` * `fpdf.enums.YPos` * `fpdf.errors.FPDFException` +* `fpdf.fonts.FontFace` * `fpdf.fpdf.TitleStyle` * `fpdf.prefs.ViewerPreferences` * `fpdf.template.Template` @@ -24,6 +25,7 @@ FPDF_FONT_DIR as _FPDF_FONT_DIR, FPDF_VERSION as _FPDF_VERSION, ) +from .fonts import FontFace from .html import HTMLMixin, HTML2FPDF from .prefs import ViewerPreferences from .template import Template, FlexTemplate @@ -51,6 +53,7 @@ # Classes: "FPDF", "FPDFException", + "FontFace", "Align", "TextMode", "XPos", diff --git a/fpdf/table.py b/fpdf/table.py index ff1442b10..4d297f745 100644 --- a/fpdf/table.py +++ b/fpdf/table.py @@ -464,6 +464,7 @@ def _render_table_cell( output=MethodReturnValue.PAGE_BREAK | MethodReturnValue.HEIGHT, wrapmode=self._wrapmode, padding=padding, + link=cell.link, **kwargs, ) diff --git a/test/table/table_with_links.pdf b/test/table/table_with_links.pdf index df559e11f04f49a4b75076e9223804c5b526d111..42e17722c626bb1759090e200f0a8fb8d5f3d71f 100644 GIT binary patch delta 3377 zcmcJRF>4e-6vxRWxne6j!NviT_GR9@nRzoJfiuaK3Mn)(Ly5OyOS5yIs^dh8QSxQtwG8t-*3bCrg0c z7uu6<$pM;%ZoLKTI=N?&3yV-h=w33Hx;Rcc&&rNqP0PM49}PGsKZIJ2^W2~GQ_Rc& zSTiuEy7-8|<9vkz`Pr zVoo+Y@YJ%u zRqkFFMtd3L6ONt1joe?P``Ly*6VC0`Ou|V~9Lij7`@eMPOo$m%UjDU zJ)R=RrBsVeFp+8gna#W|7-(&C&&x%gL4XKx5@ zVNN6^o_cc~StOLXtL|nB8voiHNG~Qs5#pPFf#UE-$ BHo*V@ delta 438 zcmZpj!n*n^%ZBfalaH|VP2SHFF94qKsRO>J81!%oPkkKp{_o3(PPuGO{qn5Hq$g!VojDFu)MAG&MyNGcvcd zv_KOxHZU?U1d7!oTWoA%V1cgL*u>Zz-7&_dMn)LwEX++n1|pkhZfRkFt{3PQQzXYs zFY#nFjx#Z}bTl(`b~Q3`wRALc1O|Y!i;