CPDFWatermark.text constructor

CPDFWatermark.text({
  1. required String textContent,
  2. required List<int> pages,
  3. Color textColor = Colors.black,
  4. int fontSize = 24,
  5. double scale = 1.0,
  6. double rotation = 45.0,
  7. double opacity = 1.0,
  8. CPDFWatermarkVerticalAlignment verticalAlignment = CPDFWatermarkVerticalAlignment.center,
  9. CPDFWatermarkHorizontalAlignment horizontalAlignment = CPDFWatermarkHorizontalAlignment.center,
  10. double verticalOffset = 0.0,
  11. double horizontalOffset = 0.0,
  12. bool isFront = true,
  13. bool isTilePage = false,
  14. double horizontalSpacing = 0.0,
  15. double verticalSpacing = 0.0,
})

Text watermark constructor

This constructor creates a text watermark with customizable properties.

  • textContent: The text content of the watermark. (Required)
  • pages: A list of page indices where the watermark should be applied, e.g., 0, 1, 2, 3 represents pages 1 through 4. (Required)
  • textColor: The color of the watermark text. Default is Colors.black.
  • fontSize: The font size of the watermark text. Default is 24.
  • scale: The scaling factor for the text. Default is 1.0.
  • rotation: The rotation angle of the watermark in degrees. Default is 45.0.
  • opacity: The transparency of the watermark, where 1.0 is fully opaque and 0.0 is fully transparent. Default is 1.0.
  • verticalAlignment: The vertical alignment of the watermark on the page. Default is CPDFWatermarkVerticalAlignment.center.
  • horizontalAlignment: The horizontal alignment of the watermark on the page. Default is CPDFWatermarkHorizontalAlignment.center.
  • verticalOffset: The vertical offset of the watermark relative to the alignment position. Default is 0.0.
  • horizontalOffset: The horizontal offset of the watermark relative to the alignment position. Default is 0.0.
  • isFront: Whether the watermark should appear in front of the page content. Default is true.
  • isTilePage: Whether the watermark should be tiled across the page. Default is false.
  • horizontalSpacing: The horizontal spacing between tiled watermarks. Default is 0.0.
  • verticalSpacing: The vertical spacing between tiled watermarks. Default is 0.0.

Implementation

CPDFWatermark.text(
    {required String textContent,
    required List<int> pages,
    Color textColor = Colors.black,
    int fontSize = 24,
    double scale = 1.0,
    double rotation = 45.0,
    double opacity = 1.0,
    CPDFWatermarkVerticalAlignment verticalAlignment =
        CPDFWatermarkVerticalAlignment.center,
    CPDFWatermarkHorizontalAlignment horizontalAlignment =
        CPDFWatermarkHorizontalAlignment.center,
    double verticalOffset = 0.0,
    double horizontalOffset = 0.0,
    bool isFront = true,
    bool isTilePage = false,
    double horizontalSpacing = 0.0,
    double verticalSpacing = 0.0})
    : this(
          type: CPDFWatermarkType.text,
          textContent: textContent,
          textColor: textColor,
          fontSize: fontSize,
          pages: pages,
          scale: scale,
          rotation: rotation,
          opacity: opacity,
          verticalAlignment: verticalAlignment,
          horizontalAlignment: horizontalAlignment,
          verticalOffset: verticalOffset,
          horizontalOffset: horizontalOffset,
          isFront: isFront,
          isTilePage: isTilePage,
          horizontalSpacing: horizontalSpacing,
          verticalSpacing: verticalSpacing);