useblocks / sphinx-simplepdf

A simple PDF builder for Sphinx documentations
https://sphinx-simplepdf.readthedocs.io
MIT License
36 stars 15 forks source link

Table width overflow for 3 or more columns #43

Closed sachin-suresh-rapyuta closed 8 months ago

sachin-suresh-rapyuta commented 1 year ago

I have a table with 4 columns and the width appears fine in the HTML, but overflows to the right in PDF and content breaks. Also I see that the text in the table is center justified.

Below is the code:

.. list-table:: Work splitter configuration parameters (``sootballs_bringup/<SITE>/sites.json``)
   :widths: 5 5 25
   :header-rows: 1
   :class: tight-table

   * - Configuration parameters
     - Sample value
     - Description
   * - ``dispatching_options_all_in_capacity_trigger``
     - 1.0
     - A weight that determines if all-in-mode is enabled.
   * - ``dispatching_options_max_block_time``
     - 2.0
     - The time [s] taken by each *TaskAssignment* loop. If ``dispatching_options_max_block_time`` is set to ``0``, no robots can be assigned any task(s).
   * - ``dispatching_options_use_all_in_mode``
     - false
     - (Task Assigner configuration). Enable/disable All-in-mode.
   * - ``dispatching_options_use_visit_table``
     - false (default)
     - (Task Assigner configuration). False does not avoid congestion.

Although the width of the 3rd column is 25, it is not reflecting in the PDF.

PDF Output:

image

danwos commented 1 year ago

The overflow is not nice and definitely a bug in our CSS.

Your other setting 5 5 25 can not work, as your first coulmn contains unbreakable text and therefore takes the space whatever is needed. As far as I know the sum of all numbers should be also 100, as it describing the relative sizes.

Can you also check, if one of the table CSS classes from here works for you. Thanks.

sachin-suresh-rapyuta commented 1 year ago

Checking that. Can you please correct the Demo PDF URL from Table Size section?

sachin-suresh-rapyuta commented 1 year ago

@danwos - was there any fix on the CSS to this issue? I tried the other CSS classes - ssp-table-wrap, ssp-tiny. I still see the PDF table breaks if I use 3 column table.

danwos commented 1 year ago

No nothing yet from my side. It's currently hard to find some time to care about it.

sachin-suresh-rapyuta commented 1 year ago

If you could let me know how to include custom directive to include in the PDF as an alternate fix for this. For example, I am trying to include excel-table directive to show in PDF.

https://pypi.org/project/sphinxcontrib-excel-table/

danwos commented 1 year ago

Mhh this should work out of the box, as long as no Javascript is doing fancy stuff.

sachin-suresh-rapyuta commented 1 year ago

It is working only in HTML, but on PDF.