Skip to content

Commit a04e575

Browse files
Eugene BochiloiText-CI
authored andcommitted
Add setter for background-image and List of background-images
DEVSIX-1948 Autoported commit. Original commit hash: [3ce2c4b32]
1 parent 99a3e6e commit a04e575

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

itext.tests/itext.layout.tests/itext/layout/BackgroundImageTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public virtual void BackgroundImageForText() {
159159
Document doc = new Document(pdfDocument);
160160
Text textElement = new Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
161161
);
162-
textElement.SetProperty(Property.BACKGROUND_IMAGE, backgroundImage);
162+
textElement.SetBackgroundImage(backgroundImage);
163163
textElement.SetFontSize(50);
164164
doc.Add(new Paragraph(textElement));
165165
}
@@ -461,7 +461,7 @@ private void BackgroundXObjectGenericTest(String filename, iText.Layout.Properti
461461
+ "in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " + "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui "
462462
+ "officia deserunt mollit anim id est laborum. ";
463463
Div div = new Div().Add(new Paragraph(text + text + text));
464-
div.SetProperty(Property.BACKGROUND_IMAGE, backgroundImage);
464+
div.SetBackgroundImage(backgroundImage);
465465
doc.Add(div);
466466
pdfDocument.Close();
467467
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, DESTINATION_FOLDER

itext/itext.layout/itext/layout/ElementPropertyContainer.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,28 @@ public virtual T SetBackgroundColor(Color backgroundColor, float opacity, float
478478
return (T)(Object)this;
479479
}
480480

481+
/// <summary>Specifies a background image for the Element.</summary>
482+
/// <param name="image">
483+
///
484+
/// <see cref="iText.Layout.Properties.BackgroundImage"/>
485+
/// </param>
486+
/// <returns>this Element.</returns>
487+
public virtual T SetBackgroundImage(BackgroundImage image) {
488+
SetProperty(Property.BACKGROUND_IMAGE, image);
489+
return (T)(Object)this;
490+
}
491+
492+
/// <summary>Specifies a list of background images for the Element.</summary>
493+
/// <param name="imagesList">
494+
/// List of
495+
/// <see cref="iText.Layout.Properties.BackgroundImage"/>
496+
/// </param>
497+
/// <returns>this Element.</returns>
498+
public virtual T SetBackgroundImage(IList<BackgroundImage> imagesList) {
499+
SetProperty(Property.BACKGROUND_IMAGE, imagesList);
500+
return (T)(Object)this;
501+
}
502+
481503
/// <summary>Sets a border for all four edges of this Element with customizable color, width, pattern type.</summary>
482504
/// <param name="border">
483505
/// a customized

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5d6db1e9bafc6bc2e35c9b0a1d71ff31b1f5dc63
1+
3ce2c4b328665253b6ecdac0797b6f5764a023bd

0 commit comments

Comments
 (0)