PdfConfig class
Configuration for the PDF document.
This class defines the overall settings for PDF generation, including page format, orientation, and margins.
Margin Types
There are two types of margins:
External margins - define the distance from the page edges:
Internal margins - define the spacing between sections:
- marginHeaderBody - space between the header and the body content
- marginBodyFooter - space between the body content and the footer
Smaller margin values create a more compact ("slim") layout, while larger values provide more breathing room between elements.
Constructors
- PdfConfig({PdfPageFormat pageFormat = PdfPageFormat.a4, bool isLandscape = false, double marginTop = 40, double marginBottom = 40, double marginLeft = 40, double marginRight = 40, double marginHeaderBody = 16, double defaultFontSize = 10, PdfColor primaryColor = PdfColors.blue800, PdfColor secondaryColor = PdfColors.grey300, PdfColor textColor = PdfColors.grey800, PdfColor alternateRowColor = const PdfColor.fromInt(0xFFF5F5F5)})
-
Creates a new PDF configuration.
const
- PdfConfig.a4Landscape({double? marginTop, double? marginBottom, double? marginLeft, double? marginRight, double? marginHeaderBody, PdfColor? primaryColor, PdfColor? secondaryColor})
-
Creates an A4 landscape configuration.
factory
- PdfConfig.a4Portrait({double? marginTop, double? marginBottom, double? marginLeft, double? marginRight, double? marginHeaderBody, PdfColor? primaryColor, PdfColor? secondaryColor})
-
Creates an A4 portrait configuration.
factory
Properties
- alternateRowColor → PdfColor
-
Background color for alternate rows in tables.
final
- contentHeight → double
-
Returns the available content height (page height minus margins).
no setter
- contentWidth → double
-
Returns the available content width (page width minus margins).
no setter
- defaultFontSize → double
-
Default font size for body text.
final
- effectivePageFormat → PdfPageFormat
-
Returns the effective page format with orientation applied.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLandscape → bool
-
Whether the page should be in landscape orientation.
final
-
Internal margin between the body content and the footer section.
final
- marginBottom → double
-
final
- marginHeaderBody → double
-
Internal margin between the header section and the body content.
final
- marginLeft → double
-
final
- marginRight → double
-
final
- marginTop → double
-
External page margins - distance from page edges.
final
- pageFormat → PdfPageFormat
-
The page format (A4, Letter, etc.).
final
- primaryColor → PdfColor
-
Primary color for the document.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondaryColor → PdfColor
-
Secondary color for the document.
final
- textColor → PdfColor
-
Text color for the document.
final
Methods
-
copyWith(
{PdfPageFormat? pageFormat, bool? isLandscape, double? marginTop, double? marginBottom, double? marginLeft, double? marginRight, double? marginHeaderBody, double? defaultFontSize, PdfColor? primaryColor, PdfColor? secondaryColor, PdfColor? textColor, PdfColor? alternateRowColor}) → PdfConfig - Creates a copy with modified properties.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited