public class Artifact extends Object implements com.aspose.ms.System.IDisposable
Class represetns PDF Artifact object.
Modifier and Type | Class and Description |
---|---|
static class |
Artifact.ArtifactSubtype
Enumeration of possible artifacts subtype.
|
static class |
Artifact.ArtifactType
Enumeration of possuble artifact types.
|
Constructor and Description |
---|
Artifact(ArtifactCollection owner,
com.aspose.pdf.Artifact.ArtifactContext context,
com.aspose.ms.System.Collections.Generic.List<Operator> _contents,
com.aspose.pdf.engine.data.IPdfDictionary _properties)
This constructor is used when artifact is read from the page.
|
Artifact(int type,
int subType)
Constructor of artifact with specified type and subtype
|
Artifact(String type,
String subType)
Constructor of artifact with specified type and subtype
|
Modifier and Type | Method and Description |
---|---|
void |
beginUpdates()
Start deleted updates.
|
void |
dispose()
Dispose the artifact.
|
int |
getArtifactHorizontalAlignment()
Gets horizontal alignment of artifact.
|
int |
getArtifactVerticalAlignment()
Gets vertical alignment of artifact.
|
double |
getBottomMargin()
Gets bottom margin of artifact.
|
List<Operator> |
getContents()
Gets collection of artifact internal operators.
|
String |
getCustomSubtype()
Gets name of artifact subtype.
|
String |
getCustomType()
Gets name of artifact type.
|
XForm |
getForm()
Gets XForm of the artifact (if XForm is used).
|
XImage |
getImage()
Gets image of the artifact (if presents).
|
double |
getLeftMargin()
Gets left margin of artifact.
|
double |
getOpacity()
Gets opacity of the artifact.
|
Point |
getPosition()
Gets artifact position.
|
Rectangle |
getRectangle()
Gets rectangle of the artifact.
|
double |
getRightMargin()
Gets right margin of artifact.
|
double |
getRotation()
Gets artifact rotation angle.
|
int |
getSubtype()
Gets artifact subtype.
|
String |
getText()
Gets text of the artifact.
|
double |
getTopMargin()
Gets top margin of artifact.
|
int |
getType()
Gets artifact type.
|
String |
getValue(String name)
Gets custom value of artifact.
|
boolean |
isBackground()
If true Artifact is placed behind page contents.
|
void |
removeValue(String name)
Remove custom value from the artifact.
|
void |
saveUpdates()
Saves all updates in artifact which were made after BeginUpdates() call.
|
void |
setArtifactHorizontalAlignment(int value)
Gets horizontal alignment of artifact.
|
void |
setArtifactVerticalAlignment(int value)
Sets vertical alignment of artifact.
|
void |
setBackground(boolean value)
If true Artifact is placed behind page contents.
|
void |
setBottomMargin(double value)
Sets bottom margin of artifact.
|
void |
setCustomSubtype(String value) |
void |
setCustomType(String value)
Sets name of artifact type.
|
void |
setImage(InputStream imageStream)
Sets image of the artifact.
|
void |
setImage(String imageName)
Sets image of the artifact.
|
void |
setLeftMargin(double value)
Sets left margin of artifact.
|
void |
setLinesAndState(String[] text,
TextState textState)
Set text and text properties of the artifact.
|
void |
setOpacity(double value)
Sets opacity of the artifact.
|
void |
setPdfPage(Page page)
Sets PDF page which is placed on the document page as artifact.
|
void |
setPosition(Point value)
Sets artifact position.
|
void |
setRightMargin(double value)
Sets right margin of artifact.
|
void |
setRotation(double value)
Sets artifact rotation angle.
|
void |
setSubtype(int value)
Sets artifact subtype.
|
void |
setText(FormattedText formattedText)
Sets text of the artifact.
|
void |
setText(String value)
Sets text of the artifact.
|
void |
setTextAndState(String text,
TextState textState)
Set text and text properties of the artifact.
|
void |
setTopMargin(double value)
Sets top margin of artifact.
|
void |
setType(int value)
Sets artifact type.
|
void |
setValue(String name,
String value)
Sets custom value of artifact.
|
public Artifact(ArtifactCollection owner, com.aspose.pdf.Artifact.ArtifactContext context, com.aspose.ms.System.Collections.Generic.List<Operator> _contents, com.aspose.pdf.engine.data.IPdfDictionary _properties)
This constructor is used when artifact is read from the page. ARtifactCollection passes page resources, initial matrix, operators of the artifact ("contents") and properties dictionary.
owner
- ArtifactCollection objectcontext
- ArtifactContext object_contents
- Collection of Operators_properties
- IPdfDictionary objectpublic Artifact(String type, String subType)
type
- Name of artifact type.subType
- NAme of artifact subtype.public Artifact(int type, int subType)
Constructor of artifact with specified type and subtype
type
- Artifact type.subType
- Artifact subtype.Artifact.ArtifactType
,
Artifact.ArtifactSubtype
public String getCustomType()
Gets name of artifact type. May be used if artifact type is non standard.
public void setCustomType(String value)
Sets name of artifact type. May be used if artifact type is non standard.
value
- String artifact namepublic String getCustomSubtype()
Gets name of artifact subtype. May be used if artifact subtype is not standard subtype.
public void setCustomSubtype(String value)
public int getType()
Gets artifact type.
Artifact.ArtifactType
public void setType(int value)
Sets artifact type.
value
- artifact type.Artifact.ArtifactType
public int getSubtype()
Gets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.
Artifact.ArtifactSubtype
public void setSubtype(int value)
Sets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.
value
- artifact subtype.Artifact.ArtifactSubtype
public List<Operator> getContents()
Gets collection of artifact internal operators.
public XForm getForm()
Gets XForm of the artifact (if XForm is used).
public Rectangle getRectangle()
Gets rectangle of the artifact.
public Point getPosition()
Gets artifact position. If this property is specified, then margins and alignments are ignored.
public void setPosition(Point value)
Sets artifact position.
value
- artifact position.public double getRightMargin()
Gets right margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
public void setRightMargin(double value)
Sets right margin of artifact.
value
- right margin of artifact.public double getLeftMargin()
Gets left margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
public void setLeftMargin(double value)
Sets left margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
value
- left margin of artifact.public double getTopMargin()
Gets top margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
public void setTopMargin(double value)
Sets top margin of artifact.
value
- top margin of artifact.public double getBottomMargin()
Gets bottom margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
public void setBottomMargin(double value)
Sets bottom margin of artifact.
value
- bottom margin.public int getArtifactHorizontalAlignment()
Gets horizontal alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.
HorizontalAlignment
public void setArtifactHorizontalAlignment(int value)
Gets horizontal alignment of artifact.
value
- horizontal alignment of artifact.HorizontalAlignment
public int getArtifactVerticalAlignment()
Gets vertical alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.
VerticalAlignment
public void setArtifactVerticalAlignment(int value)
Sets vertical alignment of artifact.
value
- vertical alignment of artifact.VerticalAlignment
public double getRotation()
Gets artifact rotation angle.
public void setRotation(double value)
Sets artifact rotation angle.
value
- artifact rotation angle.public String getText()
Gets text of the artifact.
public void setText(String value)
Sets text of the artifact.
value
- String valuepublic XImage getImage()
public double getOpacity()
Gets opacity of the artifact. Possible values are in range 0..1.
public void setOpacity(double value)
Sets opacity of the artifact. Possible values are in range 0..1.
value
- opacity of the artifact.public void setText(FormattedText formattedText)
Sets text of the artifact.
formattedText
- FormattedText object which contains artifact text.public void setTextAndState(String text, TextState textState)
Set text and text properties of the artifact.
text
- Text string.textState
- Text properties (color,public void setLinesAndState(String[] text, TextState textState)
Set text and text properties of the artifact. Allows to specify multiple lines.
text
- Array of text string.textState
- Text properties.public void setImage(InputStream imageStream)
Sets image of the artifact.
imageStream
- Stream which contains image data.public void setImage(String imageName)
Sets image of the artifact.
imageName
- Name of image file.public void setPdfPage(Page page)
Sets PDF page which is placed on the document page as artifact.
page
- Page which is placed as Artifcact.public void dispose()
Dispose the artifact.
dispose
in interface com.aspose.ms.System.IDisposable
public String getValue(String name)
Gets custom value of artifact.
name
- Name of value.public void setValue(String name, String value)
Sets custom value of artifact.
name
- Name of custom value.value
- Custom value in the artifact.public void removeValue(String name)
Remove custom value from the artifact.
name
- Name of custom value to be removed.public void beginUpdates()
Start deleted updates. Use this feature if you need make several changes to the same artifact to improve performance. Usually artifact operators are changed any time when artifact property was changed. This causes changing of page contents every time when artifact was changed. To avoid this effect put all artifact updates between StartUpdates/SaveUpdates calls. This allows to change page contents only once.
Artifact art = doc.getPages().get_Item(1).getArtifacts().get_Item(1);
art.beginUpdates();
art.setOpacity ( 0.3f);
art.setPosition ( new Point(10,10));
art.setRotation (30);
art.saveUpdates();
public void saveUpdates()
Saves all updates in artifact which were made after BeginUpdates() call.
public boolean isBackground()
If true Artifact is placed behind page contents.
public void setBackground(boolean value)
If true Artifact is placed behind page contents.
value
- boolean value