Artifact
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.ms.System.IDisposable, java.io.Closeable
public class Artifact implements System.IDisposable, Closeable
Class represents PDF Artifact object.
Constructors
Constructor | Description |
---|---|
Artifact(ArtifactCollection owner, Artifact.ArtifactContext context, System.Collections.Generic.List | This constructor is used when artifact is read from the page. |
Artifact(String type, String subType) | Constructor of artifact with specified type and subtype |
Artifact(Artifact.ArtifactType type, Artifact.ArtifactSubtype subType) | Constructor of artifact with specified type and subtype |
Methods
Method | Description |
---|---|
getCustomType() | Gets name of artifact type. |
setCustomType(String value) | Sets name of artifact type. |
getCustomSubtype() | Gets name of artifact subtype. |
setCustomSubtype(String value) | |
getType() | Gets artifact type. |
setType(Artifact.ArtifactType value) | Sets artifact type. |
getSubtype() | Gets artifact subtype. |
setSubtype(Artifact.ArtifactSubtype value) | Sets artifact subtype. |
getContents() | Gets collection of artifact internal operators. |
getForm() | Gets XForm of the artifact (if XForm is used). |
getRectangle() | Gets rectangle of the artifact. |
getPosition() | Gets artifact position. |
setPosition(Point value) | Sets artifact position. |
getRightMargin() | Gets right margin of artifact. |
setRightMargin(double value) | Sets right margin of artifact. |
getLeftMargin() | Gets left margin of artifact. |
setLeftMargin(double value) | Sets left margin of artifact. |
getTopMargin() | Gets top margin of artifact. |
setTopMargin(double value) | Sets top margin of artifact. |
getBottomMargin() | Gets bottom margin of artifact. |
setBottomMargin(double value) | Sets bottom margin of artifact. |
getArtifactHorizontalAlignment() | Gets horizontal alignment of artifact. |
setArtifactHorizontalAlignment(HorizontalAlignment value) | Gets horizontal alignment of artifact. |
getArtifactVerticalAlignment() | Gets vertical alignment of artifact. |
setArtifactVerticalAlignment(VerticalAlignment value) | Sets vertical alignment of artifact. |
getRotation() | Gets artifact rotation angle. |
setRotation(double value) | Sets artifact rotation angle. |
getText() | Gets text of the artifact. |
setText(String value) | Sets text of the artifact. |
getImage() | Gets image of the artifact (if presents). |
getOpacity() | Gets opacity of the artifact. |
setOpacity(double value) | Sets opacity of the artifact. |
setText(FormattedText formattedText) | Sets text of the artifact. |
getLines() | Lines of multiline text artifact. |
getTextState() | Text state for artifact text. |
setTextState(TextState value) | Text state for artifact text. |
setPageNumberReplacementString(String value) | Sets what string will be replaced with the page number. |
setTextAndState(String text, TextState textState) | Set text and text properties of the artifact. |
setLinesAndState(String[] text, TextState textState) | Set text and text properties of the artifact. |
setImage(InputStream imageStream) | Sets image of the artifact. |
setImage(String imageName) | Sets image of the artifact. |
setPdfPage(Page page) | Sets PDF page which is placed on the document page as artifact. |
close() | Closes all resources used by this document. |
dispose() | Dispose the artifact. |
getValue(String name) | Gets custom value of artifact. |
setValue(String name, String value) | Sets custom value of artifact. |
removeValue(String name) | Remove custom value from the artifact. |
beginUpdates() | Start deleted updates. |
saveUpdates() | Saves all updates in artifact which were made after BeginUpdates() call. |
isBackground() | If true Artifact is placed behind page contents. |
setBackground(boolean value) | If true Artifact is placed behind page contents. |
Artifact(ArtifactCollection owner, Artifact.ArtifactContext context, System.Collections.Generic.List _contents, IPdfDictionary _properties)
public Artifact(ArtifactCollection owner, Artifact.ArtifactContext context, System.Collections.Generic.List<Operator> _contents, 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.
Parameters:
Parameter | Type | Description |
---|---|---|
owner | ArtifactCollection | ArtifactCollection object |
context | com.aspose.pdf.Artifact.ArtifactContext | ArtifactContext object |
_contents | com.aspose.ms.System.Collections.Generic.List<com.aspose.pdf.Operator> | Collection of Operators |
_properties | IPdfDictionary | IPdfDictionary object |
Artifact(String type, String subType)
public Artifact(String type, String subType)
Constructor of artifact with specified type and subtype
Parameters:
Parameter | Type | Description |
---|---|---|
type | java.lang.String | Name of artifact type. |
subType | java.lang.String | NAme of artifact subtype. |
Artifact(Artifact.ArtifactType type, Artifact.ArtifactSubtype subType)
public Artifact(Artifact.ArtifactType type, Artifact.ArtifactSubtype subType)
Constructor of artifact with specified type and subtype
Parameters:
Parameter | Type | Description |
---|---|---|
type | ArtifactType | Artifact type. |
subType | ArtifactSubtype | Artifact subtype. |
getCustomType()
public String getCustomType()
Gets name of artifact type. May be used if artifact type is non standard.
Returns: java.lang.String - String artifact name
setCustomType(String value)
public void setCustomType(String value)
Sets name of artifact type. May be used if artifact type is non standard.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | String artifact name |
getCustomSubtype()
public String getCustomSubtype()
Gets name of artifact subtype. May be used if artifact subtype is not standard subtype.
Returns: java.lang.String - String value
setCustomSubtype(String value)
public void setCustomSubtype(String value)
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
getType()
public Artifact.ArtifactType getType()
Gets artifact type.
Returns: ArtifactType - artifact type value.
setType(Artifact.ArtifactType value)
public void setType(Artifact.ArtifactType value)
Sets artifact type.
Parameters:
Parameter | Type | Description |
---|---|---|
value | ArtifactType | artifact type. |
getSubtype()
public Artifact.ArtifactSubtype getSubtype()
Gets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.
Returns: ArtifactSubtype - artifact subtype.
setSubtype(Artifact.ArtifactSubtype value)
public void setSubtype(Artifact.ArtifactSubtype value)
Sets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.
Parameters:
Parameter | Type | Description |
---|---|---|
value | ArtifactSubtype | artifact subtype. |
getContents()
public List<Operator> getContents()
Gets collection of artifact internal operators.
Returns: java.util.List<com.aspose.pdf.Operator> - list artifact internal operators.
getForm()
public XForm getForm()
Gets XForm of the artifact (if XForm is used).
Returns: XForm - XForm object
getRectangle()
public Rectangle getRectangle()
Gets rectangle of the artifact.
Returns: Rectangle - Rectangle object
getPosition()
public Point getPosition()
Gets artifact position. If this property is specified, then margins and alignments are ignored.
Returns: Point - artifact position.
setPosition(Point value)
public void setPosition(Point value)
Sets artifact position.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Point | artifact position. |
getRightMargin()
public double getRightMargin()
Gets right margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: double - right margin of artifact.
setRightMargin(double value)
public void setRightMargin(double value)
Sets right margin of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | right margin of artifact. |
getLeftMargin()
public double getLeftMargin()
Gets left margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: double - left margin of artifact.
setLeftMargin(double value)
public void setLeftMargin(double value)
Sets left margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | left margin of artifact. |
getTopMargin()
public double getTopMargin()
Gets top margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: double - top margin of artifact.
setTopMargin(double value)
public void setTopMargin(double value)
Sets top margin of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | top margin of artifact. |
getBottomMargin()
public double getBottomMargin()
Gets bottom margin of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: double - bottom margin.
setBottomMargin(double value)
public void setBottomMargin(double value)
Sets bottom margin of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | bottom margin. |
getArtifactHorizontalAlignment()
public HorizontalAlignment getArtifactHorizontalAlignment()
Gets horizontal alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: HorizontalAlignment - HorizontalAlignment value
setArtifactHorizontalAlignment(HorizontalAlignment value)
public void setArtifactHorizontalAlignment(HorizontalAlignment value)
Gets horizontal alignment of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | HorizontalAlignment | horizontal alignment of artifact. |
getArtifactVerticalAlignment()
public VerticalAlignment getArtifactVerticalAlignment()
Gets vertical alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.
Returns: VerticalAlignment - VerticalAlignment value.
setArtifactVerticalAlignment(VerticalAlignment value)
public void setArtifactVerticalAlignment(VerticalAlignment value)
Sets vertical alignment of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | VerticalAlignment | vertical alignment of artifact. |
getRotation()
public double getRotation()
Gets artifact rotation angle.
Returns: double - artifact rotation angle.
setRotation(double value)
public void setRotation(double value)
Sets artifact rotation angle.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | artifact rotation angle. |
getText()
public String getText()
Gets text of the artifact.
Returns: java.lang.String - String value
setText(String value)
public void setText(String value)
Sets text of the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | String value |
getImage()
public XImage getImage()
Gets image of the artifact (if presents).
Returns: XImage - XImage object
getOpacity()
public double getOpacity()
Gets opacity of the artifact. Possible values are in range 0..1.
Returns: double - opacity of the artifact.
setOpacity(double value)
public void setOpacity(double value)
Sets opacity of the artifact. Possible values are in range 0..1.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double | opacity of the artifact. |
setText(FormattedText formattedText)
public void setText(FormattedText formattedText)
Sets text of the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
formattedText | FormattedText | FormattedText object which contains artifact text. |
getLines()
public final List<String> getLines()
Lines of multiline text artifact.
Returns: java.util.List<java.lang.String> - List of Strings
getTextState()
public final TextState getTextState()
Text state for artifact text.
Returns: TextState - TextState instance
setTextState(TextState value)
public final void setTextState(TextState value)
Text state for artifact text.
Parameters:
Parameter | Type | Description |
---|---|---|
value | TextState | TextState instance |
setPageNumberReplacementString(String value)
public final void setPageNumberReplacementString(String value)
Sets what string will be replaced with the page number. The default value is #.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String |
setTextAndState(String text, TextState textState)
public void setTextAndState(String text, TextState textState)
Set text and text properties of the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
text | java.lang.String | Text string. |
textState | TextState | Text state. |
setLinesAndState(String[] text, TextState textState)
public void setLinesAndState(String[] text, TextState textState)
Set text and text properties of the artifact. Allows to specify multiple lines.
Parameters:
Parameter | Type | Description |
---|---|---|
text | java.lang.String[] | Array of text string. |
textState | TextState | Text properties. |
setImage(InputStream imageStream)
public void setImage(InputStream imageStream)
Sets image of the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
imageStream | java.io.InputStream | Stream which contains image data. |
setImage(String imageName)
public void setImage(String imageName)
Sets image of the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
imageName | java.lang.String | Name of image file. |
setPdfPage(Page page)
public void setPdfPage(Page page)
Sets PDF page which is placed on the document page as artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
page | Page | Page which is placed as Artifcact. |
close()
public void close()
Closes all resources used by this document.
dispose()
public void dispose()
Dispose the artifact.
This method is obsolete, use close() instead.
getValue(String name)
public String getValue(String name)
Gets custom value of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
name | java.lang.String | Name of value. |
Returns: java.lang.String - Value, or null if value does not exists.
setValue(String name, String value)
public void setValue(String name, String value)
Sets custom value of artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
name | java.lang.String | Name of custom value. |
value | java.lang.String | Custom value in the artifact. |
removeValue(String name)
public void removeValue(String name)
Remove custom value from the artifact.
Parameters:
Parameter | Type | Description |
---|---|---|
name | java.lang.String | Name of custom value to be removed. |
beginUpdates()
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();
saveUpdates()
public void saveUpdates()
Saves all updates in artifact which were made after BeginUpdates() call.
isBackground()
public boolean isBackground()
If true Artifact is placed behind page contents.
Returns: boolean - boolean value
setBackground(boolean value)
public void setBackground(boolean value)
If true Artifact is placed behind page contents.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |