pub struct PdfParagraph<'a> { /* private fields */ }
Expand description

A group of PdfPageTextObject objects contained in the same PdfPageObjects collection that should be laid out together as a single paragraph.

Text layout in PDF files is handled entirely by text objects. Each text object contains a single span of text that is styled consistently and can be at most a single line long. Paragraphs containing multiple lines, with different internal text styles, are formed from multiple text objects stitched together visually at the time the page is generated. There is no native functionality for retrieving a single paragraph from its constituent text objects. This makes it difficult to work with long spans of text.

The PdfParagraph is an attempt to improve multi-line text handling. Paragraphs can be created from existing groups of page objects, or created by scratch; once created, text in a paragraph can be edited and re-formatted, and then used to generate a group of text objects that can be placed on a page.

Implementations

Creates a set of one or more PdfParagraph objects from the given list of page objects.

Creates a new, empty [PdfPageParagraphObject] with the given maximum line width, overflow, and alignment settings.

Returns true if this PdfParagraph contains no fragments.

Adds a new fragment containing the given styled string to this paragraph.

Returns the maximum line width of this paragraph.

Sets the maximum line width of this paragraph to the given value.

Sets the maximum height of this paragraph to the given value.

Returns the text contained within all text fragments in this paragraph.

Returns the text contained within all text fragments in this paragraph, separating each text fragment with the given separator.

Assembles the fragments in this paragraph into lines, taking into account the paragraph’s current sizing, overflow, indent, and alignment settings, and generates new page objects for each line, adding all generated page objects to a new PdfPageGroupObject.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.