aspose.pdf
Class Watermarks

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by aspose.pdf.Watermarks
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class Watermarks
extends java.util.ArrayList

Represents a collection of FloatingBox,which lay upon other content for the identification purpose as watermark, Only Image, Graph and Text are allowed in FloatingBox. are added on each page.

Typical usages are the following:

[Java] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); Text text1 = new Text("This is text in section1."); sec1.getParagraphs().add(text1); text1.setLeft(30); text1.setTop(100); sec1.getParagraphs().add(text1); Section sec2 = pdf1.getSections().add(); Text text2= new Text("This is text in section2."); text2.setLeft(30); text2.setTop(100); sec1.getParagraphs().add(text2); //image watermark Image image1 = new Image(); image1.getImageInfo().setFile("C:/images/apple.jpg"); image1.getImageInfo().setImageFileType(ImageFileType.Jpeg); image1.setImageScale(0.1f); FloatingBox watermark1= new FloatingBox(200,200); watermark1.setBoxHorizontalPositioning(BoxHorizontalPositioningType.Page); watermark1.setBoxHorizontalAlignment(BoxHorizontalAlignmentType.Center); watermark1.setBoxVerticalPositioning(BoxVerticalPositioningType.Page); watermark1.setBoxVerticalAlignment(BoxVerticalAlignmentType.Center); watermark1.getParagraphs().add(image1); //graph watermark Graph graph1 = new Graph(400,100); float[] posArr = new float[]{0,0,200,80,300,40,350,90}; Curve curve1 = new Curve(graph1,posArr); graph1.getShapes().add(curve1); FloatingBox watermark2 = new FloatingBox(400,100); watermark2.getParagraphs().add(graph1); //text watermark Text text3 = new Text("Text Watermark"); FloatingBox watermark3 = new FloatingBox(100,100); watermark3.setLeft(50); watermark3.setTop(500); watermark3.getParagraphs().add(text3); pdf1.getWatermarks().Add(watermark1); pdf1.getWatermarks().Add(watermark2); pdf1.getWatermarks().Add(watermark3); pdf1.save(....); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf" > <Section ID="section1"> <Text Left="30" Top="100"> <Segment>This is text in section1.</Segment> </Text> </Section> <Section ID="section2"> <Text Left="30" Top="100"> <Segment>"This is text in section2."</Segment> </Text> </Section> <Watermark Width="200" Height="100" BoxHorizontalPositioning="Page" BoxHorizontalAlignment="Center" BoxVerticalPositioning="Page" BoxVerticalAlignment="Center"> <Image File="world.jpg" Type="jpeg" ImageScale="0.1" /> </Watermark> <Watermark Width="400" Height="100"> <Graph Width="400" Height="100"> <Curve Position="0 0 200 80 300 40 350 90" /> </Graph> </Watermark> <Watermark Width="100" Height="100" Left ="50" Top="500"> <Text > <Segment IsUnicode="true" FontSize="12">Text Watermark</Segment> </Text> </Watermark> </Pdf>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Watermarks()
          Construct a default Watermarks object .
 
Method Summary
 void Add(FloatingBox watermark)
          Adds a new Inserts a new object into the collection.
 void addPara(FloatingBox watermark)
          Inserts a new FloatingBox object into the collection at specified position.
 void Insert(FloatingBox watermarkToInsertAfter, FloatingBox newWatermark)
          Inserts a new FloatingBox object into the collection after specified FloatingBox object.
 void insertPara(FloatingBox watermarkToInsertAfter, FloatingBox newWatermark)
          Inserts a new FloatingBox object into the collection after specified Cell object.
 void insertPara(int index, FloatingBox watermark)
          Inserts a new FloatingBox object into the collection after specified Cell object.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

Watermarks

public Watermarks()
Construct a default Watermarks object .

Method Detail

Add

public void Add(FloatingBox watermark)
Adds a new Inserts a new object into the collection.

Parameters:
watermark - The FloatingBox object to be added.

addPara

public void addPara(FloatingBox watermark)
Inserts a new FloatingBox object into the collection at specified position.

The zero-based index at witch FloatingBox object should be inserted.

Parameters:
watermark - The FloatingBox object to be inserted.

insertPara

public void insertPara(int index,
                       FloatingBox watermark)
Inserts a new FloatingBox object into the collection after specified Cell object.

Parameters:
index - The FloatingBox object to insert after.
watermark - The FloatingBox object to be inserted.

insertPara

public void insertPara(FloatingBox watermarkToInsertAfter,
                       FloatingBox newWatermark)
Inserts a new FloatingBox object into the collection after specified Cell object.

Parameters:
watermarkToInsertAfter - The FloatingBox object to insert after.
newWatermark - The FloatingBox object to be inserted.

Insert

public void Insert(FloatingBox watermarkToInsertAfter,
                   FloatingBox newWatermark)
Inserts a new FloatingBox object into the collection after specified FloatingBox object.

Parameters:
watermarkToInsertAfter - The FloatingBox object to insert after. If this object is null, the new object will be inserted as the first member.
newWatermark - The FloatingBox object to be inserted.