question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Literal blocks do not shink with newer versions of ReportLab

See original GitHub issue

Even when running rst2pdf with --fit-literal-mode=shrink literal blocks to not shrink when they spill over the page edge.

It looks like in ReportLab the function _listWrapOn behaves differently now. There is a configuration parameter for reportlab listWrapOnFakeWidth which needs to be set to False for _listWrapOn to return the correct width.

Current workaround, is to create reportlab_settings.py in the same directory (or on your Python path) with the following:

listWrapOnFakeWidth = False

rst2pdf --version 0.93.dev-r0

reportlab.version ‘3.2.0’

literal-block.txt literal-block.pdf

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stoggicommented, Nov 30, 2015

We may be able to simply set fakeWidth=False in flowables.py:729:

self.width, self.height = _listWrapOn(self.content, maxWidth, None, fakeWidth=False)

Although, I am unsure what fakeWidth is for, and what impact this would have.

0reactions
ralsinacommented, Nov 7, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

ReportLab: How to auto resize text to fit block - Stack Overflow
I've been looking at the docs as described below and can't seem to find one. I've been trying to recursively resize the style.fontSize...
Read more >
RML User Guide | ReportLab
ReportLab PLUS. ReportLab's solution solves several central problems that ebusinesses face in creating publishing caliber reports that are customized ...
Read more >
rst2pdf/CHANGES.rst at main - GitHub
Migrate to the new format using python -m rst2pdf.style2yaml as per the "Migrating ... In any case, literal blocks are not supposed to...
Read more >
rst2pdf - PyPI
Convert restructured text to PDF via reportlab. ... New in 0.10 ... Different modes to handle too-large literal blocks: overflow/truncate/shrink.
Read more >
How to use rst2pdf
0 means no level starts in a new page. break_level=0 # How section breaks work. ... Currently, these semantics only work for literal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found