com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class Artifact

    • Constructor Detail

      • 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.

        Parameters:
        owner - ArtifactCollection object
        context - ArtifactContext object
        _contents - Collection of Operators
        _properties - IPdfDictionary object
      • Artifact

        public Artifact(String type,
                        String subType)
        Constructor of artifact with specified type and subtype
        Parameters:
        type - Name of artifact type.
        subType - NAme of artifact subtype.
      • Artifact

        public Artifact(int type,
                        int subType)

        Constructor of artifact with specified type and subtype

        Parameters:
        type - Artifact type.
        subType - Artifact subtype.
        See Also:
        Artifact.ArtifactType, Artifact.ArtifactSubtype
    • Method Detail

      • getCustomType

        public String getCustomType()

        Gets name of artifact type. May be used if artifact type is non standard.

        Returns:
        String artifact name
      • setCustomType

        public void setCustomType(String value)

        Sets name of artifact type. May be used if artifact type is non standard.

        Parameters:
        value - String artifact name
      • getCustomSubtype

        public String getCustomSubtype()

        Gets name of artifact subtype. May be used if artifact subtype is not standard subtype.

        Returns:
        String value
      • setCustomSubtype

        public void setCustomSubtype(String value)
      • getType

        public int getType()

        Gets artifact type.

        Returns:
        artifact type value.
        See Also:
        Artifact.ArtifactType
      • setType

        public void setType(int value)

        Sets artifact type.

        Parameters:
        value - artifact type.
        See Also:
        Artifact.ArtifactType
      • getSubtype

        public int getSubtype()

        Gets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.

        Returns:
        artifact subtype.
        See Also:
        Artifact.ArtifactSubtype
      • setSubtype

        public void setSubtype(int value)

        Sets artifact subtype. If artifact has non-standard subtype, name of the subtype may be read via CustomSubtype.

        Parameters:
        value - artifact subtype.
        See Also:
        Artifact.ArtifactSubtype
      • getContents

        public List<Operator> getContents()

        Gets collection of artifact internal operators.

        Returns:
        list artifact internal operators.
      • getForm

        public XForm getForm()

        Gets XForm of the artifact (if XForm is used).

        Returns:
        XForm object
      • getRectangle

        public Rectangle getRectangle()

        Gets rectangle of the artifact.

        Returns:
        Rectangle object
      • getPosition

        public Point getPosition()

        Gets artifact position. If this property is specified, then margins and alignments are ignored.

        Returns:
        artifact position.
      • setPosition

        public void setPosition(Point value)

        Sets artifact position.

        Parameters:
        value - artifact position.
      • getRightMargin

        public double getRightMargin()

        Gets right margin of artifact. If position is specified explicitly (in Position property) this value is ignored.

        Returns:
        right margin of artifact.
      • setRightMargin

        public void setRightMargin(double value)

        Sets right margin of artifact.

        Parameters:
        value - 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:
        left margin of artifact.
      • setLeftMargin

        public void setLeftMargin(double value)

        Sets left margin of artifact. If position is specified explicitly (in Position property) this value is ignored.

        Parameters:
        value - 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:
        top margin of artifact.
      • setTopMargin

        public void setTopMargin(double value)

        Sets top margin of artifact.

        Parameters:
        value - 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:
        bottom margin.
      • setBottomMargin

        public void setBottomMargin(double value)

        Sets bottom margin of artifact.

        Parameters:
        value - bottom margin.
      • getArtifactHorizontalAlignment

        public int getArtifactHorizontalAlignment()

        Gets horizontal alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.

        Returns:
        HorizontalAlignment value
        See Also:
        HorizontalAlignment
      • setArtifactHorizontalAlignment

        public void setArtifactHorizontalAlignment(int value)

        Gets horizontal alignment of artifact.

        Parameters:
        value - horizontal alignment of artifact.
        See Also:
        HorizontalAlignment
      • getArtifactVerticalAlignment

        public int getArtifactVerticalAlignment()

        Gets vertical alignment of artifact. If position is specified explicitly (in Position property) this value is ignored.

        Returns:
        VerticalAlignment value.
        See Also:
        VerticalAlignment
      • setArtifactVerticalAlignment

        public void setArtifactVerticalAlignment(int value)

        Sets vertical alignment of artifact.

        Parameters:
        value - vertical alignment of artifact.
        See Also:
        VerticalAlignment
      • getRotation

        public double getRotation()

        Gets artifact rotation angle.

        Returns:
        artifact rotation angle.
      • setRotation

        public void setRotation(double value)

        Sets artifact rotation angle.

        Parameters:
        value - artifact rotation angle.
      • getText

        public String getText()

        Gets text of the artifact.

        Returns:
        String value
      • setText

        public void setText(String value)

        Sets text of the artifact.

        Parameters:
        value - String value
      • getImage

        public XImage getImage()
        Gets image of the artifact (if presents).
        Returns:
        XImage object
      • getOpacity

        public double getOpacity()

        Gets opacity of the artifact. Possible values are in range 0..1.

        Returns:
        opacity of the artifact.
      • setOpacity

        public void setOpacity(double value)

        Sets opacity of the artifact. Possible values are in range 0..1.

        Parameters:
        value - opacity of the artifact.
      • setText

        public void setText(FormattedText formattedText)

        Sets text of the artifact.

        Parameters:
        formattedText - FormattedText object which contains artifact text.
      • setTextAndState

        public void setTextAndState(String text,
                                    TextState textState)

        Set text and text properties of the artifact.

        Parameters:
        text - Text string.
        textState - Text properties (color,
      • setLinesAndState

        public void setLinesAndState(String[] text,
                                     TextState textState)

        Set text and text properties of the artifact. Allows to specify multiple lines.

        Parameters:
        text - Array of text string.
        textState - Text properties.
      • setImage

        public void setImage(InputStream imageStream)

        Sets image of the artifact.

        Parameters:
        imageStream - Stream which contains image data.
      • setImage

        public void setImage(String imageName)

        Sets image of the artifact.

        Parameters:
        imageName - Name of image file.
      • setPdfPage

        public void setPdfPage(Page page)

        Sets PDF page which is placed on the document page as artifact.

        Parameters:
        page - Page which is placed as Artifcact.
      • dispose

        public void dispose()

        Dispose the artifact.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • getValue

        public String getValue(String name)

        Gets custom value of artifact.

        Parameters:
        name - Name of value.
        Returns:
        Value, or null if value does not exists.
      • setValue

        public void setValue(String name,
                             String value)

        Sets custom value of artifact.

        Parameters:
        name - Name of custom value.
        value - Custom value in the artifact.
      • removeValue

        public void removeValue(String name)

        Remove custom value from the artifact.

        Parameters:
        name - 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 value
      • setBackground

        public void setBackground(boolean value)

        If true Artifact is placed behind page contents.

        Parameters:
        value - boolean value