BackgroundImage { public BackgroundRepeat getRepeat() { if (repeatX == repeat.isNoRepeatOnXAxis()) { repeat = new BackgroundRepeat(repeatX ? BackgroundRepeatValue.REPEAT : BackgroundRepeatValue.NO_REPEAT, repeat.getYAxisRepeat()); } if (repeatY == repeat.isNoRepeatOnYAxis()) { repeat = new BackgroundRepeat(repeat.getXAxisRepeat(), repeatY ? BackgroundRepeatValue.REPEAT : BackgroundRepeatValue.NO_REPEAT); } return repeat; } BackgroundImage(BackgroundImage backgroundImage); @Deprecated  BackgroundImage(final PdfImageXObject image, final BackgroundRepeat repeat, final BlendMode blendMode); @Deprecated  BackgroundImage(final PdfFormXObject image, final BackgroundRepeat repeat, final BlendMode blendMode); @Deprecated  BackgroundImage(final PdfImageXObject image, final BackgroundRepeat repeat); @Deprecated  BackgroundImage(final PdfFormXObject image, final BackgroundRepeat repeat); @Deprecated  BackgroundImage(final PdfImageXObject image); @Deprecated  BackgroundImage(final PdfFormXObject image); @Deprecated  BackgroundImage(final PdfImageXObject image, final boolean repeatX, final boolean repeatY); @Deprecated  BackgroundImage(final PdfFormXObject image, final boolean repeatX, final boolean repeatY); @Deprecated  BackgroundImage(final AbstractLinearGradientBuilder linearGradientBuilder); @Deprecated  BackgroundImage(final AbstractLinearGradientBuilder linearGradientBuilder, final BlendMode blendMode); private  BackgroundImage(PdfXObject image, BackgroundRepeat repeat, BackgroundPosition position,
            BackgroundSize backgroundSize, AbstractLinearGradientBuilder linearGradientBuilder,
            BlendMode blendMode, BackgroundBox clip, BackgroundBox origin); PdfImageXObject getImage(); PdfFormXObject getForm(); BackgroundPosition getBackgroundPosition(); AbstractLinearGradientBuilder getLinearGradientBuilder(); boolean isBackgroundSpecified(); @Deprecated boolean isRepeatX(); @Deprecated boolean isRepeatY(); BackgroundSize getBackgroundSize(); float getImageWidth(); float getImageHeight(); @Deprecated float getWidth(); @Deprecated float getHeight(); BackgroundRepeat getRepeat(); BlendMode getBlendMode(); BackgroundBox getBackgroundClip(); BackgroundBox getBackgroundOrigin();  }
@Test public void backgroundImageWithoutRepeatXTest() throws IOException, InterruptedException { PdfImageXObject xObject = new PdfImageXObject(ImageDataFactory.create(SOURCE_FOLDER + "itis.jpg")); BackgroundImage backgroundImage = new BackgroundImage .Builder().setImage(xObject).setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.NO_REPEAT, BackgroundRepeatValue.REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundImageGenericTest("backgroundImageWithoutRepeatX", backgroundImage); }
@Test public void backgroundImageWithoutRepeatYTest() throws IOException, InterruptedException { PdfImageXObject xObject = new PdfImageXObject(ImageDataFactory.create(SOURCE_FOLDER + "itis.jpg")); BackgroundImage backgroundImage = new BackgroundImage .Builder().setImage(xObject).setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.REPEAT, BackgroundRepeatValue.NO_REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundImageGenericTest("backgroundImageWithoutRepeatY", backgroundImage); }
@Test public void backgroundImageWithoutRepeatXYTest() throws IOException, InterruptedException { PdfImageXObject xObject = new PdfImageXObject(ImageDataFactory.create(SOURCE_FOLDER + "itis.jpg")); BackgroundImage backgroundImage = new BackgroundImage .Builder().setImage(xObject).setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.NO_REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundImageGenericTest("backgroundImageWithoutRepeatXY", backgroundImage); }
@Test public void backgroundXObject() throws IOException, InterruptedException { String filename = "backgroundXObject"; String fileName = filename + ".pdf"; String outFileName = DESTINATION_FOLDER + fileName; try (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new FileOutputStream(outFileName)))) { BackgroundImage backgroundImage = new BackgroundImage.Builder().setImage(createFormXObject(pdfDocument, "itis.jpg")).build(); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundXObjectGenericTest(filename, backgroundImage, pdfDocument); } }
@Test public void backgroundXObjectWithoutRepeatX() throws IOException, InterruptedException { String filename = "backgroundXObjectWithoutRepeatX"; String fileName = filename + ".pdf"; String outFileName = DESTINATION_FOLDER + fileName; try (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new FileOutputStream(outFileName)))) { BackgroundImage backgroundImage = new BackgroundImage.Builder() .setImage(createFormXObject(pdfDocument, "itis.jpg")) .setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.NO_REPEAT, BackgroundRepeatValue.REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundXObjectGenericTest(filename, backgroundImage, pdfDocument); } }
@Test public void backgroundXObjectWithoutRepeatY() throws IOException, InterruptedException { String filename = "backgroundXObjectWithoutRepeatY"; String fileName = filename + ".pdf"; String outFileName = DESTINATION_FOLDER + fileName; try (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new FileOutputStream(outFileName)))) { BackgroundImage backgroundImage = new BackgroundImage .Builder().setImage(createFormXObject(pdfDocument, "itis.jpg")) .setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.REPEAT, BackgroundRepeatValue.NO_REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundXObjectGenericTest(filename, backgroundImage, pdfDocument); } }
@Test public void backgroundXObjectWithoutRepeatXY() throws IOException, InterruptedException { String filename = "backgroundXObjectWithoutRepeatXY"; String fileName = filename + ".pdf"; String outFileName = DESTINATION_FOLDER + fileName; try (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new FileOutputStream(outFileName)))) { BackgroundImage backgroundImage = new BackgroundImage .Builder().setImage(createFormXObject(pdfDocument, "itis.jpg")) .setBackgroundRepeat(new BackgroundRepeat(BackgroundRepeatValue.NO_REPEAT)).build(); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getXAxisRepeat()); Assert.assertEquals(BackgroundRepeatValue.NO_REPEAT, backgroundImage.getRepeat().getYAxisRepeat()); backgroundXObjectGenericTest(filename, backgroundImage, pdfDocument); } }