Working with ChemDraw JS

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 (also see archived version) 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 contacting 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);

ChemDraw JS resources

"}}]}},{"type":"br","props":{}}]}},{"type":"p","props":{"children":"This script loads the perkinelmer object into the window which is used to create a ChemDraw JS instance:"}},{"type":"pre","props":{"style":{"fontFamily":"SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace,sans-serif","fontSize":"85%","lineHeight":"1.35"},"children":[{"props":{"children":[{"type":"span","props":{"style":{"color":"#001080"},"children":"window"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"."}},{"type":"span","props":{"style":{"color":"#001080"},"children":"perkinelmer"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"."}},{"type":"span","props":{"style":{"color":"#001080"},"children":"ChemdrawwebManager"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"."}},{"type":"span","props":{"style":{"color":"#795E26"},"children":"attach"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"({"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#001080"},"children":"license:"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#A31515"},"children":"'"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" {"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#008000"},"children":"// Use the `chemdraw` instance here, call APIs, etc."}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" },"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#795E26"},"children":"errorCallback"}},{"type":"span","props":{"style":{"color":"#001080"},"children":":"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" ("}},{"type":"span","props":{"style":{"color":"#001080"},"children":"error"}},{"type":"span","props":{"style":{"color":"#000000"},"children":") "}},{"type":"span","props":{"style":{"color":"#0000FF"},"children":"=>"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" {"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#008000"},"children":"// ..."}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" },"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" });"}}]}},{"type":"br","props":{}}]}},{"type":"p","props":{"children":["In the ",{"type":"code","props":{"style":{"fontFamily":"SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace,sans-serif","fontSize":"85%"},"children":{"props":{"children":[{"type":"span","props":{"style":{"color":"inherit"},"children":"callback"}}]}}}}," callback, use the chemdraw to load an example CDXML:"]}},{"type":"pre","props":{"style":{"fontFamily":"SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace,sans-serif","fontSize":"85%","lineHeight":"1.35"},"children":[{"props":{"children":[{"type":"span","props":{"style":{"color":"#0000FF"},"children":"const"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#0070C1"},"children":"dimethylamineCdxml"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" = "}},{"type":"span","props":{"style":{"color":"#A31515"},"children":"`"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#A31515"},"children":" `"}},{"type":"span","props":{"style":{"color":"#000000"},"children":";"}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"props":{"children":"\n"}},{"type":"span","props":{"style":{"color":"#000000"},"children":" "}},{"type":"span","props":{"style":{"color":"#001080"},"children":"chemdraw"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"."}},{"type":"span","props":{"style":{"color":"#795E26"},"children":"loadCDXML"}},{"type":"span","props":{"style":{"color":"#000000"},"children":"("}},{"type":"span","props":{"style":{"color":"#001080"},"children":"dimethylamineCdxml"}},{"type":"span","props":{"style":{"color":"#000000"},"children":");"}}]}},{"type":"br","props":{}}]}},{"type":"h2","props":{"children":"ChemDraw JS resources"}},{"type":"ul","props":{"children":[{"type":"li","props":{"children":{"type":"a","props":{"href":"https://chemdrawdirect.perkinelmer.cloud/js/docs/User%20Guide/ChemDraw%20JS.htm","target":"_blank","rel":"noopener noreferrer nofollow","children":"ChemDraw JS User Guide"}}}},{"type":"li","props":{"children":{"type":"a","props":{"href":"https://chemdrawdirect.perkinelmer.cloud/js/docs/Developers%20Guide_Service/Developers%20Guide.htm","target":"_blank","rel":"noopener noreferrer nofollow","children":"ChemDraw JS Developer's Guide"}}}},{"type":"li","props":{"children":{"type":"a","props":{"href":"https://chemdrawdirect.perkinelmer.cloud/js/docs/API%20Reference/API%20Reference%20Guide.htm","target":"_blank","rel":"noopener noreferrer nofollow","children":"ChemDraw JS API Reference"}}}}]}}]}},{"type":"div","props":{"style":{"width":5,"height":1,"overflow":"hidden"},"children":[{"type":"div","props":{"style":{"height":5}}},[]]}}]}},"categoryBreadcrumbs":["Projects and blogs","Bio- and cheminformatics"],"title":"Working with ChemDraw JS","description":"ChemDraw JS makes it possible to create, view, and edit chemical structures in the browser.","seeAlso":[{"slug":"awesome-chemdraw","title":"Awesome ChemDraw","description":"A curated list of awesome ChemDraw resources, tutorials, and more."},{"slug":"structural-formula-viewer","title":"Structural Formula Viewer","description":"View structural formulas of chemical compounds."},{"slug":"smiles-to-structure","title":"SMILES to Structure","description":"Convert SMILES (simplified molecular-input line-entry system) to a structure online."},{"slug":"iupac-multiplicative-prefix-generator","title":"IUPAC Multiplicative Prefix Generator","description":"Generate IUPAC multiplicative prefixes for naming chemical compounds."},{"slug":"molecule-of-the-day","title":"Molecule of the Day","description":"Discover a new molecule every day."},{"slug":"smiles-to-structure-api","title":"SMILES to Structure API","description":"A web service for converting SMILES (simplified molecular-input line-entry system) to MOL."},{"slug":"canonical-smiles-generator","title":"Canonical SMILES Generator","description":"Convert a SMILES string to its canonical (kekulized) form."},{"slug":"smiles-to-iupac","title":"SMILES to IUPAC","description":"Convert SMILES to IUPAC name online."},{"slug":"iupac-to-smiles","title":"IUPAC to SMILES","description":"Convert IUPAC names to SMILES strings."},{"slug":"iupac-to-structure","title":"IUPAC to Structure","description":"Convert IUPAC names to 2D structures."},{"slug":"smiles-to-inchi","title":"SMILES to InChI","description":"Convert SMILES to InChI string online."},{"slug":"inchikey-to-smiles","title":"InChIKey to SMILES","description":"An online tool for converting (resolving) InChIKeys to SMILES strings."},{"slug":"smiles-parse-tree-viewer","title":"SMILES Parse Tree Viewer","description":"Visualize the parse tree of a SMILES string."},{"slug":"3d-mol-viewer","title":"3D Mol Viewer","description":"View molecular models in 3D."},{"slug":"smiles-to-3d-structure","title":"SMILES to 3D Structure (SMILES to Conformer)","description":"Convert SMILES (simplified molecular-input line-entry system) to a 3D structure online."},{"slug":"cheminformatics-crossword","title":"Cheminformatics Crossword","description":"A daily crossword puzzle for cheminformatics terms."},{"slug":"mol-editor","title":"Mol Editor","description":"A simple online editor for Mol files."},{"slug":"awesome-smiles","title":"Awesome SMILES","description":"A curated list of awesome links, tutorials, and resources on SMILES (simplified molecular-input line-entry system)."},{"slug":"awesome-cheminformatics","title":"Awesome cheminformatics","description":"A curated list of awesome cheminformatics resources."},{"slug":"periodic-table-crossword","title":"Periodic Table Crossword","description":"A daily crossword puzzle for chemical elements."},{"slug":"chemical-engineering-crossword","title":"Chemical Engineering Crossword","description":"A daily crossword puzzle for chemical engineering terms."},{"slug":"organic-chemistry-crossword","title":"Organic Chemistry Crossword","description":"A daily crossword puzzle for organic chemistry terms."}]},"antvaset",{"shortName":"Anton Vasetenkov","longName":"Anton Vasetenkov","hasProducts":false,"logoColor":"#111","logo":{"type":"text","text":"Anton Vasetenkov","style":{}}});