How make it display the entire contents of the normal?
See original GitHub issueHi,
When the contents of the <p> paragraphs in the html code are too long, How can I make it display the entire contents of the normal? No artificial add tags,eg: <br>. I tried to use css to limit the maximum length, and automatic word wrap, but it still can not.
test case:
# -*- coding: utf-8 -*-
import xhtml2pdf.pisa as pisa
pisa.showLogging()
def dumpErrors(pdf, showLog=True):
if pdf.warn:
print "*** %d WARNINGS OCCURED" % pdf.warn
if pdf.err:
print "*** %d ERRORS OCCURED" % pdf.err
def testlong(src="example.html", dest="example.pdf"):
pdf = pisa.CreatePDF(file(src, "r"), file(dest, "wb"))
dumpErrors(pdf)
if not pdf.err:
pisa.startViewer(dest)
if __name__=="__main__":
testlong()
the example html code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<style>
body{
font-family: 'Gilles';
}
.testdiv {
width:100%;
max-width:500px;
word-break:break-all;
}
</style>
</head>
<body>
<div class="testdiv">
<p>
"sdfsdfsdfffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwggggggggggggggggggggggggpppppppppppaaaaaaazzzzzzzzzzxxxxxxxccccccvvvvvvvbbbbnnnnnnnnmmmmmkkkkkkkkllllll"
</p>
</div>
</body>
</html>
the Pdf display is like this:
"sdfsdfsdfffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwggggggggggggggggggggggggpppppppppppaaaaaaazzzzzzzzzzxxxxxxxccccc
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to Display Contents of a File in Linux
The simplest way to view text files in Linux is the cat command. It displays the complete contents in the command line without...
Read more >View display settings in Windows
View display settings in Windows · Select Start > Settings > System > Display. · If you want to change the size of...
Read more >How display: contents; Works
The pseudo-elements of an element with display: contents are considered to be part of its children, so are displayed as normal. <style> .outer...
Read more >display - CSS: Cascading Style Sheets - MDN Web Docs
The display CSS property sets whether an element is treated as a block or inline element and the layout used for its children, ......
Read more >Adjust the display and text size on iPhone
On iPhone, customize the display settings to make the screen easier to ... To change the text size for all apps, tap All...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vuonghv try to use property
It helped me. I could find this only in the source code, there is no documentation for this for some reason.
Notice that word may be broken at any character, as in
word-break: break-all;
@p-mazhnik 3 years later, thanks!!! I have wasted like 3 hours of work until I found your reply. Thanks a lot!!