Skip to content

New line in continued section between 2 text() #1192

@krufab

Description

@krufab

Feature Request

Feature description

It seems it is not possible to easily have multiple columns with multiple formats.
At the moment you can have a long text split in multiple columns if you have:

doc.text(longText, {align: 'justified', columns: 3, columnGap: 15})

However, 2 subsequent text() call will create 2 distinct areas of 3 columns and longText2 will not continue from the same column of longText1.

doc.text(longText1, {align: 'justified', columns: 3, columnGap: 15})
doc.text(longText2, {align: 'justified', columns: 3, columnGap: 15})

A workaround is to use the continued option for the first (or both) instructions. This will make longText2 effectively follow longText1.
However, it seems it is not possible to have a line break between the 2 texts, that is, continue in the same column, but after a new line, to five a sense of different paragraph (texts with new lines at the end are simply trimmed).

doc.text(longText1, {align: 'justified', columns: 3, columnGap: 15, continued: true})
doc.text(longText2, {align: 'justified', columns: 3, columnGap: 15, continued: true})

Would it be possible to introduce a newLine() which continues the same column section, but adds the test on a new line with some indent?

I've created a PR which introduces a new option, lineBreakAfter, which simply adds a new line to the text before closing a section and starting the new continued one. It seems to work, but maybe a specific function would be simplet to use. Also, I managed only to have it working introducing the new line after the text, not before. I believe it would be useful to let the user decide whether to have the text forcing a new line after it, or a new text starting on a new line, depending on the cases.
Let me know if the PR could be useful, so that I can add more documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions