Comments (4)
I've implemented a simple django filter as a workaround to this issue:
from textwrap import wrap
from django import template
register = template.Library()
@register.filter
def text_wrap(text, width=70):
"""
The used PDF libs don't allow CSS word-wrap, so to split long words (e.g. urls)
we wrap the text by lines and join them with spaces to have multiple lines. See:
https://github.com/nigma/django-easy-pdf/issues/65
https://github.com/xhtml2pdf/xhtml2pdf/issues/379
"""
return ' '.join(wrap(text, width))
In the html template I just import and use the custom filter:
{% load pdf_filters %}
{{ my_long_value|text_wrap }}
from django-easy-pdf.
Me too, i can't break line on td table 😢
from django-easy-pdf.
Same. Using a table and can't wrap long text.
from django-easy-pdf.
where to import these line of code,
from django-easy-pdf.
Related Issues (20)
- How to display page numbers in the footer
- link external style sheet not working HOT 3
- Allow files to be named and displayed on the screen
- Fix context request
- keep getting wrong operand type error on pdfs.
- Conditional PDF rendering based on query parameters
- 为什么中文会出现乱码,如何解决 HOT 2
- Question
- Render dynamic template before creating pdf view
- utf-8 not working HOT 2
- css not working when updated to 0.2.0.dev1
- TypeError at /cart/ get_context_data() missing 1 required positional argument: 'request' HOT 2
- Add support for Django 3.0 HOT 9
- Django.utils.six Error on MacOS HOT 3
- project not maintained HOT 11
- Add style in html: OK but add static font in render, possible ???
- you have breaked my code
- error 1
- error 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-easy-pdf.