danfickle / danfickle/openhtmltopdf

Bottom text in table layout page

Open
#614 2 comments 0 reactions 1 assignee Claimed by @danfickle View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

Hi @danfickle, @syjer

I've found some issue after upgrade from version 1.0.4 to 1.0.5.

Till now, I had such template:

![layout](https://user-images.githubusercontent.com/38613340/100746096-8d39d300-33e0-11eb-82b5-fc70a32967a8.png)

```



Lorem document

@page {
size: A4;
margin: 32px;
background-color: #fafafa;
}

*, ::after, ::before {
box-sizing: border-box;
}

html, body {
height: 100%;
margin: 0;
padding: 0;
background-color: #b86eab;
}

body {
font: 16px/1.4 'Nunito', 'DejaVuSans', sans-serif;
background-color: #fafafa;
word-wrap: break-word;
}

.align-top {
vertical-align: top !important;
}

.align-bottom {
vertical-align: bottom !important;
}

/* table */

table.layout {
background-color: #fffcdd;
margin: 0;
padding: 0;
height: 100%;
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}

table.layout td {
vertical-align: top;
padding: 0;
margin: 0;
}

.bottom-text {
margin-bottom: 1px;
}




Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut





Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut



```

The trick was to use:

```
.bottom-text {
margin-bottom: 1px;
}
```

to prevent bottom text flow to next page.

But since version 1.0.5 it not works this way anymore.

Not it requires at least

```
.bottom-text {
margin-bottom: 3px;
}
```

I've also discovered its somehow connected with line-height property (after removing 1.4 line-height it requires only 1px).

Happy debugging 😀
I will be very grateful if it works without any margin-bottom tricks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.