Segment¶
-
class
pdfpug.modules.
Segment
(data, **kwargs)¶ A segment is used to create a grouping of related content.
Parameters: - data – Content to be grouped
- segment_type (Optional[SegmentType]) – Visual style
- aligment (Optional[Alignment]) – Horizontal alignment of all content
- spacing (Optional[SegmentSpacing]) – Padding around the content
- emphasis (Optional[SegmentEmphasis]) – Emphasis strength of segment
>>> from pdfpug.modules import Segment, Header, Paragraph, UnorderedList >>> from pdfpug.common import HeaderTier >>> segment = Segment( ... [ ... Header('Segment', tier=HeaderTier.h3), ... Paragraph( ... 'Segments are <b>collection views</b> that can be used to group ' ... 'content together. They can contain images, headers, and any ' ... 'other elements that is supported by PdfPug. Segments come in ' ... 'different styles that can be used to modify it to different use ' ... 'cases.' ... ), ... Paragraph('Some segment types are listed below,'), ... UnorderedList(['Stacked', 'Piled', 'Vertical', 'Basic']) ... ], ... )
The appearance of segments can be styled for different use cases and preferences,
>>> from pdfpug.common import SegmentType >>> segment.segment_type = SegmentType.stacked
-
class
pdfpug.modules.
Segments
(segments, **kwargs)¶ A group of
Segment
can be formatted to appear together usingSegments
.Parameters: - segments (
List
[Union
[Segment
,Segments
]]) – Group of segments - segments_type (Optional[SegmentType]) – Visual style
- orientation (Optional[Orientation]) – Orientation of elements
- segments (
-
class
pdfpug.common.
SegmentType
¶ Enum Segment Type
-
basic
= 'basic'¶ Basic segment type with no special formatting
-
stacked
= 'stacked'¶ Segment that appears to contain multiple pages which are stacked cleanly
-
piled
= 'piled'¶ Segment that appears to look like a pile of papers
-
vertical
= 'vertical'¶ Segment type that formats the content to be aligned as part of a vertical group
-
circular
= 'circular'¶ Circular segment type. For a circle, ensure content has equal width and height
-