-
-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Severe misplacing of table and bullet list: superimposed over other text #775
Comments
Cannot reproduce the misplacements with the given CSS and HTML. |
I have found the problem, so I don't (?) need to supply the complete HTML and CSS? The cause:
So this one table or list and table were floating. I didn't even consider the page header as playing a role because the header worked fine on other pages. In retrospect, as the table in the text kinda floated, and the headers are kinda floated, maybe I should have guessed. I didn't. When I (accidentally) discovered that the @page's header's table's closing </table> was corrupt, the problem disappeared. Sorry for the disturbance, closing this. It might be a big ask, but maybe - for others - any "open" tags in whatever goes into the header should be artificially closed. I can't imagine any scenario where this behavior would be desired. |
@AbsurdMagpieScrutinies I'm stunned. What's your trick to incorporate a |
Umm, I used css and html: @page { size: A4;
/*
* < snip >
*
*/
/*
* Not this.
* This is just sticking content into the @page's margins
*
*/
@bottom-left {
font-size: 8pt;
font-family: "Franklin Gothic Book";
font-weight: bold;
content: "Doc ID: {{doc_id}}";
border-top: 1pt solid rgb(167,25,48);
width: 20%;
}
@bottom-center {
font-size: 8pt;
font-family: "Franklin Gothic Book";
font-weight: bold;
content: "{{todays_date}} Version:{{version_number}}";
border-top: 1pt solid rgb(167,25,48);
width: 60%;
}
@bottom-right {
font-size: 8pt;
font-family: "Franklin Gothic Book";
font-weight: bold;
content: "Page " counter(page) " of " counter(pages);
border-top: 1pt solid rgb(167,25,48);
width: 20%;
}
/*
* Here:
*
* I used
* content: element(some-name-here)
*
*/
/* --- page header --- */
@top-left {
content: element(pageHeader);
}
}
/*
*
* Then I made a class or Id with
* position: running(some-name-here)
*
*/
#pageHeader {
display: block;
position: running(pageHeader); /* takes out of the normal document */
font-style: bold;
height: 20mm;
}
/*
*
* This is the CSS for the page header
* This is not really the point, but for completeness
*
*/
.headerTable {
/* overriding the default table sizing */
display: block;
/* force offset (fixed) within parent div */
position: fixed;
left: 0px;
top: -25mm;
table-layout: fixed;
width:100%;
background-color: #f0f0f0;
/* wrapping of text in cells */
overflow:hidden;
/* padding, borders, margins */
padding:0px 0px;
/* border-bottom: 1px solid black; */
/* margin-bottom: 30mm; */
}
.headerTable td{ /* the first column */
font-family:"Franklin Gothic Book";
font-size:16px;
font-weight: normal;
padding:0px 0px;
word-break:normal;
background-color: #f0f0f0;
border-bottom: None;
}
/* override default table's "every-line underline" */
.headerTable th, .headerTable tr, .headerTable td{
/* font-weight: normal; */
border-bottom: None;
}
/* override the default column widths */
.headerTable tr td:first-child {/* column 1 */
width: 160mm;
}
.headerTable tr td:first-child + td{/* column 2 */
width: auto;
}
.headerTable .image_box{
border-color:inherit;
text-align:right;
vertical-align:top;
}
/* Department name, GNS */
.headerTable .h_row_1{
font-weight: bold;
font-style: normal;
border-color:inherit;
text-align:left;
vertical-align:top;
font-style: bold;
}
/* this SOP's/ Doc's name */
.headerTable .h_row_2 {
font-weight: bold;
font-style: italic;
vertical-align: top;
text-align: left;
}
And then, in the html (which I - a program - built up out of a few pieces) there is <!-- this is not part of the html body, nor part of the layout calcs -->
<!-- the pageHeader id has postiton: element(pageHeader), removing its -->
<!-- content from the page proper -->
<!-- This is each page's header -->
<div id="pageHeader">
<table class="headerTable">
<tr>
<td class="h_row_1">
Te Pū Ao GNS Science, Natural Hazards; GeoNet Network Dept<br>
</td>
<td class="image_box" rowspan="2">
<img src="{{gns_logo_path}}"
style="width:51px; height:86px; align:right" alt="GNS Logo"/>
</td>
</tr>
<tr>
<td class="h_row_2"> {{H1_Title}} </td>
</tr>
</table>
</div> That's it. For the record, it was that last </table> tag that somehow had lost its "/" that made me open this ticket, thinking that there was something wrong with weasyprint. There wasn't . |
@AbsurdMagpieScrutinies You're aware that WeasyPrint doesn't support |
The reason that I'm not aware of WeasyPrint doesn't support running() and element() is . . . that they work fine in Weasyprint.
You are telling me what works? Well, ok. Maybe you could have a look at these pdfs
|
😄 @Tontyna is actually right: |
Alas, no magic involved. What a pity 😞 |
Given CSS of
The html
is converted into a pdf with the second bullet list and the table superimposed over the first bullet list.
My machine:
The text was updated successfully, but these errors were encountered: