59. pasteImageAs
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 59. pasteImageAs

Parameter syntax:

    'into'|'toOrInto' | ('to'|'before'|'after' [ implicit_selection ]?)
    S '#template(' element_name ',' template_title ')'

Variant of command `paste` which pastes the image copied to the system clipboard as an element.

The element to be pasted is specified using an element template. This element template must have a descendant element or attribute containing a string starting with "`image-URI:`". After the "`image-URI:`" prefix, an absolute or relativeURI specifies a template for the path of the save files used to store the pasted images.

XHTML example:

    pasteImageAs toOrInto #template({http://www.w3.org/1999/xhtml}img,PIA.img)

where element template `PIA.img` is:

    <elementTemplate name="PIA.img" selectable="false">
      <img xmlns="http://www.w3.org/1999/xhtml"
           src="image-URI:images/img.jpg" alt="???"/>
    </elementTemplate>

Using the above command creates files called `images/img14135.jpg`[5], `images/img20338.jpg`, `images/img60659.jpg`, etc, where `images/` is a subfolder of the folder containing the document being edited.

DITA example:

    pasteImageAs after[implicitElement] #template(fig,PIA.fig)

where element template `PIA.fig` is:

    <elementTemplate name="PIA.fig" selectable="false">
      <fig xmlns="">
        <title></title>
        <image href="image-URI:image.png" />
      </fig>
    </elementTemplate>

Using the above command creates files called `image29116.png`, `image89803.png`, `image09833.png`, etc, into the folder containing the document being edited.

[5] The user is of course prompted to choose a more meaningful filename.

Prev | Up | Next
58. pasteAfterAs | Home | 60. pasteSystemSelection