See also:
Quaject
Articles
Topics
How-tos
ChemDraw logo

Working with ChemDraw JS

Anton Vasetenkov
Web, data, bio, language.
ChemDraw

ChemDraw JS is a library for working with chemical structures. Its features include drawing chemical structures and reactions and converting names to structures and structures to names. It also supports hotkeys and shortcuts, structure templates, and structure query tools.

Notable users of ChemDraw JS include ChemDraw Cloud, Signals Notebook Individual Edition, Lead Discovery, and PerkinElmer Signals Lead Discovery.

A demo site showcases the features of the library.

Using ChemDraw JS

To use ChemDraw JS in your app, you need a license file. You can get the license file by contact PerkinElmer.

Load the ChemDraw JS script

<script src="https://chemdrawdirect.perkinelmer.cloud/js/chemdrawweb/chemdrawweb.js"></script>

This script loads the perkinelmer object into the window which is used to create a ChemDraw JS instance:

window.perkinelmer.ChemdrawwebManager.attach({
  license: '<?xml version="1.0" encoding="UTF-8" standalone="no"?><License ...',
  element: document.getElementById('chemdraw-mounting-point'),
  callback: (chemdraw) => {
    // Use the `chemdraw` instance here, call APIs, etc.
  },
  errorCallback: (error) => {
    // ...
  }
});

In the callback callback, use the chemdraw to load an example CDXML:

const dimethylamineCdxml =
  `<?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE CDXML SYSTEM "http://www.cambridgesoft.com/xml/cdxml.dtd">
  <CDXML>
    <page>
      <fragment>
        <n id="9" p="106 118" />
        <n id="11" p="131.98 103" Element="7" />
        <n id="13" p="157.96 118" />
        <b id="12" B="9" E="11" />
        <b id="14" B="11" E="13" />
      </fragment>
    </page>
  </CDXML>`;

chemdraw.loadCDXML(dimethylamineCdxml);

See also

See also