Skip to content
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

KeepTogether on ListItem not implemented #380

Open
stonewoodman opened this issue Jun 18, 2020 · 2 comments
Open

KeepTogether on ListItem not implemented #380

stonewoodman opened this issue Jun 18, 2020 · 2 comments

Comments

@stonewoodman
Copy link

@stonewoodman stonewoodman commented Jun 18, 2020

The value keeptogether on a ListItem is ignored

ListItem listItem = new ListItem("multiline text...", font);
listItem.setKeepTogether(true);

expected result
The flag has the same behavior as by Paragraph.

@andreasrosdal
Copy link

@andreasrosdal andreasrosdal commented Jun 18, 2020

Pull requests welcome.

@arnthom
Copy link

@arnthom arnthom commented Jun 18, 2020

OK, method getKeepTogether() is used in PdfDocument.add(Element) if the element is Paragraph, but not if it is ListItem, although ListItem extends Paragraph ...

public boolean add(Element element) throws DocumentException {
...
        try {
            switch(element.type()) {
...
                case Element.PARAGRAPH: {
...
                    // if a paragraph has to be kept together, we wrap it in a table object
                    if (paragraph.getKeepTogether()) {
...
                case Element.LISTITEM: {
...

@asturio asturio linked a pull request May 24, 2021 that will close this issue
@asturio asturio linked a pull request May 24, 2021 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants