ChemDraw JS 17.1 API Reference Guide Chem Draw
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 45
Download | ![]() |
Open PDF In Browser | View PDF |
PerkinElmer ChemDraw® JS as a Service 17.1 API Reference Guide Last Updated: January 22, 2018 ChemDraw JS as a Service 17.1: API Reference Guide Table of Contents Global Objects perkinelmer.ChemdrawWebManager attach(options) : void Parameters Returns Example Classes ChemDrawDirect addProduct(cdxml) : number Parameters Returns Example addReactant(cdxml) : number Parameters Returns Example addReagent(cdxml) : number Parameters Returns Example clear() : void Parameters Returns Example convertToCDXML(content, mimeType, callback) : void Parameters Returns Example findReactions(callback) : void Parameters Returns Example fitToContainer() : void Parameters Returns Example getAllFragmentsInfo([options]) : ArrayParameters Returns © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 8 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 11 11 11 11 12 12 12 12 13 13 13 13 13 13 14 14 14 14 2 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example getB64CDX() : string Parameters Returns Example getCDXML() : string Parameters Returns Example getCanvasSize() : Size Parameters Returns Example getDocumentName() : string Parameters Returns Example getErrors() : Array Parameters Returns Example getFragmentsInfo([options]) : Array Parameters Returns Deprecated Example getImgUrl() : string Parameters Returns Example getInChI(callback) : void Parameters Returns Example getInChIKey(callback) : void Parameters Returns Example getMOL(callback) : void Parameters Returns © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 14 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 17 17 17 17 17 17 18 18 18 18 18 18 18 19 19 19 19 19 20 20 20 20 20 21 21 3 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example getMOLV3000(callback) : void Parameters Returns Example getMolecularWeight(content, mimeType, callback) : void Parameters Returns Example getProperties(callback) : void Parameters Returns Example getRXN(callback) : void Parameters Returns Example getRXNV3000(callback) : void Parameters Returns Example getSMILES(callback) : void Parameters Returns Example getSVG(callback) : void Parameters Returns Example getSelectedFragmentsInfo([options]) : Array Parameters Returns Example getVersion() : string Parameters Returns Example isBlankStructure() : boolean Parameters Returns Example © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 21 21 21 21 22 22 22 22 22 23 23 23 23 24 24 24 24 25 25 25 25 25 26 26 26 26 26 26 27 27 27 27 27 28 28 28 28 28 28 28 29 4 of 45 ChemDraw JS as a Service 17.1: API Reference Guide isSaved() : boolean Parameters Returns Example labelFragments(ids) : void Parameters Returns Example loadB64CDX(b64CDX, callback) : void Parameters Returns Example loadCDXML(cdxml) : void Parameters Returns Example loadConfig(config) : void Parameters Returns Example loadConfigFromUrl(url, callback) : void Parameters Returns Example loadMOL(mol, callback) : void Parameters Returns Example loadSMILES(smiles, callback) : void Parameters Returns Example markAsSaved() : void Parameters Returns Example nameToStructure(name, callback) : void Parameters Returns Example setCanvasSize(size[, options]) : void © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 29 29 29 29 29 30 30 30 30 30 30 30 31 31 31 31 31 32 32 32 32 32 32 32 33 33 33 33 34 34 34 34 35 35 35 35 35 35 35 35 36 5 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Returns Example setContentChangedHandler(handler) : void Parameters Returns Example setDocumentName(name) : void Parameters Returns Example setViewOnly(viewOnly) : void Parameters Returns Example structureToName(cdxml, callback) : void Parameters Returns Example JSON Structures ApplicationProperties Properties AttachOptions Properties Configuration Properties ContentChangedEvent Properties Features Properties FragmentInfo Properties GetFragmentsInfoOptions Properties SetCanvasSizeOptions Properties Size Properties Tool Properties ToolGroup © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 36 36 36 37 37 37 37 37 38 38 38 38 38 38 38 39 39 39 39 40 40 40 40 40 40 41 41 41 41 41 41 41 42 42 42 42 42 42 42 43 43 6 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Properties ToolsLayout Properties Callbacks AttachCallback Parameters ConfigLoadCallback Parameters ContentChangedHandler Parameters ErrorCallback Parameters GetNumberCallback Parameters GetTextContentCallback Parameters LoadDocumentCallback Parameters © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 43 43 43 44 44 44 44 44 44 44 44 44 44 45 45 45 45 45 7 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Global Objects perkinelmer.ChemdrawWebManager The singleton global object to manage ChemDraw JS instances. attach(options) : void Creates a new ChemDraw JS tool and attaches it to the specified DOM node. The attach function may be used to attach several instances of ChemDraw to the DOM and may be called at any time. The ChemDraw instance cannot be used immediately once this functions returns. A callback function can be specified in the input JSON object. Then it can be called after the instance becomes available. Please refer to the Developers Guide for details. Parameters Name Type Description options AttachOptions which is object contains some parameters to configure ChemDraw JS Returns void Example var chemdrawjs; function chemDrawAttached(chemdrawweb) { // Implement your own logic here, call API chemdrawjs= chemdrawweb; } perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: chemDrawAttached }); © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 8 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Classes ChemDrawDirect Provides APIs to manage the ChemDraw document, canvas and drawings on the canvas. addProduct(cdxml) : number Appends a new product to the reaction present in the current drawing. If there are products present, the new product will be added to the right of the right-most product. If no reaction is present, a new arrow will be added to the center of the canvas along with the product. Parameters Name Type cdxml Description string the CDXML string Returns number the ID of the new product Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs= chemdrawweb; } }); chemdrawjs.addProduct("CDXML content..."); addReactant(cdxml) : number Appends a new reactant to the reaction present in the current drawing. If there are reactants present, the new reactant is added to the left of the left-most reactant. If no reaction is present, a new arrow is added to the center of the canvas along with the reactant. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 9 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type cdxml Description string the CDXML string Returns number the ID of the new reactant Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs= chemdrawweb; } }); chemdrawjs.addReactant("CDXML content..."); addReagent(cdxml) : number Appends a new reagent to the reaction present in the current drawing. The reagent is added to the top of the reaction arrow and above the top-most reagent if there are any already. If no reaction is present, a new arrow is added to the center of the canvas, along with the reagent. Parameters Name Type cdxml Description string the CDXML string Returns number the ID of the new reagent Example var chemdrawjs; © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 10 of 45 ChemDraw JS as a Service 17.1: API Reference Guide perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.addReagent("CDXML content..."); clear() : void Clears all drawings on the ChemDraw canvas. This operation is not undoable. And ChemDraw will not prompt the user to confirm the operation. Parameters None Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.clear(); convertToCDXML(content, mimeType, callback) : void Converts structure string to CDXML format. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 11 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description content string the structure string mimeType string the string format type, ex: chemical/x-cdx, chemical/x-mdlmolfile, chemical/x-helm callback the callback function to be called after the result is generated GetTextContentCallback Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.convertToCDXML("Structure content...", "Structure mine type...", function (cdxml, error) { if (!error) { // deal with result } else { // deal with error } }); findReactions(callback) : void Returns reactions information of the current drawing. This call is asynchronous and a callback function must be provided that is informed when the results are available. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 12 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description callback GetTextContentCallback function when finish loading Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.findReactions(function (reactions, error) { if (!error) { // deal with result } else { // deal with error } }); fitToContainer() : void Resizes ChemDraw instance to fit to the container. Parameters None Returns void © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 13 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.fitToContainer(); getAllFragmentsInfo([options]) : Array Gets information of all fragments on the canvas which contains CDXML string and preview PNG picture. Parameters Name Type Description options GetFragmentsInfoOptions Optional the options for getting fragments information Returns Array an array of fragments information which contains CDXML string and preview PNG picture Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var fragmentsInfo = chemdrawjs.getAllFragmentsInfo(); var cdxml = fragmentsInfo.cdxml; var image = fragmentsInfo.image; // ... © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 14 of 45 ChemDraw JS as a Service 17.1: API Reference Guide getB64CDX() : string Returns a CDX base64 string representing the current drawing. Parameters None Returns string a CDX base64 string representing the current drawing Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var b64cdx = chemdrawjs.getB64CDX(); getCDXML() : string Returns a CDXML string representing the current drawing. Parameters None Returns string a CDXML string representing the current drawing Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 15 of 45 ChemDraw JS as a Service 17.1: API Reference Guide chemdrawjs = chemdrawweb; } }); var cdxml = chemdrawjs.getCDXML(); getCanvasSize() : Size Gets ChemDraw JS's current canvas size. Parameters None Returns Size ChemDraw JS's current canvas size Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var size = chemdrawjs.getCanvasSize(); var width = size.width; var height = size.height; getDocumentName() : string Gets the underlying document name which is saved in the CDXML. Parameters None Returns string the underlying document name which is saved in the CDXML © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 16 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var name = chemdrawjs.getDocumentName(); getErrors() : Array Returns an array of strings describing the chemical errors that are present in the current drawings. Parameters None Returns Array an array of strings describing the chemical errors that are present in the current drawings Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var errors = chemdrawjs.getErrors(); getFragmentsInfo([options]) : Array Gets fragments information which contains CDXML string and preview PNG picture. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 17 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description options GetFragmentsInfoOptions Optional the options for getting fragments information Returns Array an array of fragments information which contains CDXML string and preview PNG picture Deprecated Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var fragmentsInfo = chemdrawjs.getFragmentsInfo(); var cdxml = fragmentsInfo.cdxml; var image = fragmentsInfo.image; // ... getImgUrl() : string Returns a URL string which points to a PNG representation of the current drawing. The image contents are encoded in the URL so that it can be used offline. Parameters None Returns string a URL string which points to a PNG representation of the current drawing © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 18 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var imageUrl = chemdrawjs.getImgUrl(); getInChI(callback) : void Translates the current drawing into an InChI representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getInChI(function (inchI, error) { if (!error) { // deal with result © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 19 of 45 ChemDraw JS as a Service 17.1: API Reference Guide } else { // deal with error } }); getInChIKey(callback) : void Translates the current drawing into an InChIKey representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getInChIKey(function (inchIKey, error) { if (!error) { // deal with result } else { // deal with error } }); getMOL(callback) : void Translates the current drawing into a MOL v2000 representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 20 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getMOL(function (mol, error) { if (!error) { // deal with result } else { // deal with error } }); getMOLV3000(callback) : void Translates the current drawing into a MOL v3000 representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 21 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getMOLV3000(function (molv3000, error) { if (!error) { // deal with result } else { // deal with error } }); getMolecularWeight(content, mimeType, callback) : void Gets molecular weight of the structure. Parameters Name Type Description content string the structure string mimeType string the string format type, ex: chemical/x-cdx, chemical/x-mdl-molfile, chemical/x-helm callback the callback function to be called after the result is generated GetNumberCallback Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 22 of 45 ChemDraw JS as a Service 17.1: API Reference Guide callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getMolecularWeight("Structure content...", "Structure mine type...", function (weight, error) { if (!error) { // deal with result } else { // deal with error } }); getProperties(callback) : void Returns properties of the current drawing. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getProperties(function (props, error) { © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 23 of 45 ChemDraw JS as a Service 17.1: API Reference Guide if (!error) { // deal with result } else { // deal with error } }); getRXN(callback) : void Translates the current drawing into a RXN v2000 representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getRXN(function (rxn, error) { if (!error) { // deal with result } else { // deal with error } }); © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 24 of 45 ChemDraw JS as a Service 17.1: API Reference Guide getRXNV3000(callback) : void Translates the current drawing into a RXN v3000 representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getRXNV3000(function (rxnv3000, error) { if (!error) { // deal with result } else { // deal with error } }); getSMILES(callback) : void Translates the current drawing into a SMILES representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 25 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getSMILES(function (smiles, error) { if (!error) { // deal with result } else { // deal with error } }); getSVG(callback) : void Translates the current drawing into a SVG representation. This call is asynchronous. A callback function can to be provided and it will be invoked after the result is generated. Parameters Name Type Description callback GetTextContentCallback the callback function to be called after the result is generated Returns void © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 26 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.getSVG(function (svg, error) { if (!error) { // deal with result } else { // deal with error } }); getSelectedFragmentsInfo([options]) : Array Gets information of the selected fragments on the canvas which contains CDXML string and preview PNG picture. Parameters Name Type Description options GetFragmentsInfoOptions Optional the options for getting fragments information Returns Array an array information of the selected fragments on the canvas which contains CDXML string and preview PNG picture Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 27 of 45 ChemDraw JS as a Service 17.1: API Reference Guide } }); var fragmentsInfo = chemdrawjs.getSelectedFragmentsInfo(); var cdxml = fragmentsInfo.cdxml; var image = fragmentsInfo.image; // ... getVersion() : string Returns the current version of ChemDraw as a string. Parameters None Returns string the current version of ChemDraw Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var version = chemdrawjs.getVersion(); isBlankStructure() : boolean Returns true if nothing has been drawn in ChemDraw and false if something has been drawn. Parameters None Returns boolean true if nothing has been drawn in ChemDraw and false if something has been drawn © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 28 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var isBlank = chemdrawjs.isBlankStructure(); isSaved() : boolean Determines if there is any unsaved change. Parameters None Returns boolean true if there is any unsaved change, otherwise false Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); var isSaved = chemdrawjs.isSaved(); labelFragments(ids) : void Auto-number the fragments of the reaction with Roman numeral labels. Any existing labels will be replaced with the new ones. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 29 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type ids Description Array the array of the fragments to be labelled Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.labelFragments([1, 2, 3]); loadB64CDX(b64CDX, callback) : void Reads a BASE64 encoded CDX string and loads its contents into ChemDraw. This call is asynchronous. A callback function can to be provided and it will be invoked after the loading is done. Parameters Name Type Description b64CDX string the CDX base64 encoded string callback function when finish loading LoadDocumentCallback Returns void Example var chemdrawjs; © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 30 of 45 ChemDraw JS as a Service 17.1: API Reference Guide perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadB64CDX("CDX base64 content..."); loadCDXML(cdxml) : void Reads a CDXML string and loads its contents into ChemDraw. Parameters Name Type cdxml Description string the CDXML string Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadCDXML("CDXML content..."); loadConfig(config) : void Applies a new configuration into ChemDraw. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 31 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type config Description string ¦ Configuration the configuration json object or json string Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadConfig("Configuration JSON string"); // chemdrawjs.loadConfig({}); or Configuration JSON Object loadConfigFromUrl(url, callback) : void Applies a new configuration from remote url into ChemDraw. Parameters Name Type Description url string the remote configuration file url callback ConfigLoadCallback when finished, this function will be called Returns void Example var chemdrawjs; © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 32 of 45 ChemDraw JS as a Service 17.1: API Reference Guide perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadConfigFromUrl("remote configuration file url", function (error) { // if error is undefined configuration is done // if error isn't undefined, it shows the error message during the loading progress }); loadMOL(mol, callback) : void Reads a MOL string and loads its contents into ChemDraw. This call is asynchronous. A callback function can to be provided and it will be invoked after the loading is done. Parameters Name Type Description mol string the MOL string callback LoadDocumentCallback function when finish loading Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadMOL("MOL content...", function (cdxml, error) { if (!error) { © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 33 of 45 ChemDraw JS as a Service 17.1: API Reference Guide // deal with result } else { // deal with error } }); loadSMILES(smiles, callback) : void Reads a SMILES string and loads its contents into ChemDraw. This call is asynchronous. A callback function can to be provided and it will be invoked after the loading is done. Parameters Name Type Description smiles string the SMILES string callback LoadDocumentCallback function when finish loading Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.loadSMILES("SMILES content...", function (cdxml, error) { if (!error) { // deal with result } else { // deal with error } }); © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 34 of 45 ChemDraw JS as a Service 17.1: API Reference Guide markAsSaved() : void Sets the dirty flag to indicate the canvas is saved and clean. Parameters None Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.markAsSaved(); nameToStructure(name, callback) : void Reads a structure name and returns a CDXML string representing the structure. Parameters Name Type Description name string the name of the structure to be converted callback GetTextContentCallback the callback function to be called after converting is done Returns void Example var chemdrawjs; © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 35 of 45 ChemDraw JS as a Service 17.1: API Reference Guide perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.nameToStructure("structureName", function (cdxml, error) { if (!error) { // deal with result } else { // deal with error } }); setCanvasSize(size[, options]) : void Sets ChemDraw JS canvas size. Parameters Name Type Description size Size the new canvas size options SetCanvasSizeOptions Optional the options to configure the canvas size Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 36 of 45 ChemDraw JS as a Service 17.1: API Reference Guide var size = { width: 100, height: 100 }; var options = { doNotCropDrawings: false }; chemdrawjs.setCanvasSize(size, options); setContentChangedHandler(handler) : void Sets a callback function which will be invoked when user makes any change on the canvas. Parameters Name Type Description handler ContentChangedHandler the callback function Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.setContentChangedHandler(function (event) { // Implement your own logic here }); setDocumentName(name) : void Sets the document name to the resulting CDXML. © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 37 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type name Description string the document name to set Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.setDocumentName("document name"); setViewOnly(viewOnly) : void Sets whether the user is able to interact with ChemDraw. Parameters Name Type Description viewOnly boolean indicator the ChemDraw JS instance is view only or not Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 38 of 45 ChemDraw JS as a Service 17.1: API Reference Guide callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.setViewOnly(); structureToName(cdxml, callback) : void Reads a CDXML string and returns the name of the structure. Parameters Name Type Description cdxml string the CDXML string to be converted callback GetTextContentCallback the callback function to be called after converting is done Returns void Example var chemdrawjs; perkinelmer.ChemdrawwebManager.attach({ id: "chemdrawjsContainer", callback: function (chemdrawweb) { chemdrawjs = chemdrawweb; } }); chemdrawjs.structureToName("CDXML content...", function (name, error) { if (!error) { // deal with result } else { // deal with error } }); © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 39 of 45 ChemDraw JS as a Service 17.1: API Reference Guide JSON Structures ApplicationProperties Application properties Properties Name Type Description StyleSheet string The name of the default document stylesheet chemservice string The end point of the ChemDraw web service AttachOptions The options for creating and attaching a new ChemDraw JS instance Properties Name Type Description callback AttachCallback Optional The callback function to be invoked after the new ChemDraw JS instance is attached config Configuration Optional The configuration JSON object configUrl string Optional The URL to a remote configuration file element HTMLElement Optional The object of the HTML element to be attached to errorCallback ErrorCallback Optional The callback function when ChemDraw JS is failed to load or attach id string Optional The ID of the HTML element to be attached to license string Optional The license file content to initialize ChemDraw JS licenseUrl string Optional The license file URL to initialize ChemDraw JS preservePageInfo boolean Optional Determines the view mode of ChemDraw JS viewonly Optional Determines the initial state of ChemDraw JS (view only or editable) boolean Configuration The ChemDraw JS configuration © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 40 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Properties Name Type Description appProperties ApplicationProperties Other application properties features Features Feature toggles layout ToolsLayout Toolbar layout ContentChangedEvent The event for content change handler Properties Name Type action Description string The action name Features Features Properties Name Type Description disabled Array The list of disabled features enabled Array The list of enabled features FragmentInfo Structure information on the canvas Properties Name Type Description cdxml string The structure CDXML string height number The structure height id number The fragment id image string The structure preview PNG picture encoded in BASE64 © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 41 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Name Type Description width number The structure width x number The structure location x y number The structure location y GetFragmentsInfoOptions Options for getting fragments information Properties Name Type Description borderSize number Optional The size of the border transparentBackground boolean Optional Determines if the background should be transparent or not SetCanvasSizeOptions The option for setting canvas size Properties Name Type Description doNotCropDrawings boolean Optional Determines whether crop the drawing when change the canvas size. Size The size object contains width and height Properties Name Type Description height number height in pixel width number width in pixel Tool Tool © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 42 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Properties Name Type order Description Array Configure tool item order, it could be single tool or group tool ToolGroup Group tool instance Properties Name Type Description collapse string Collapse mode:"auto", "always", "never" columns string The number of columns of the expanded tool group panel group string The name of the tool group order Array The order of the sub tools writingMode string Optional The layout mode of the expanded tool group panel: "horizontal", "vertical" ToolsLayout Tools layout Properties Name Type orientation string tools Description Toolbar orientation. "Horizontal", "Vertical" Array The list of tools or tool groups © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 43 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Callbacks AttachCallback A callback function which is called after ChemDraw JS is attached Parameters Name Type Description cdd the new instance of ChemDraw JS ChemDrawDirect ConfigLoadCallback A callback function which is called after a new configuration is loaded Parameters Name Type error Description string Optional the error message during the loading process ContentChangedHandler The callback function which will return the event Parameters Name Type Description event the action description when does changes on canvas ContentChangedEvent ErrorCallback Callback function indicating error happens. Parameters Name Type Description error Error The error detail GetNumberCallback The callback function which will return the number and error © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 44 of 45 ChemDraw JS as a Service 17.1: API Reference Guide Parameters Name Type Description value number the result number error string the error message if any exception occurs GetTextContentCallback The callback function which will return the string and error Parameters Name Type Description content string the result string error string the error message if some exceptions occur LoadDocumentCallback The callback function which will return the CDXML string and error Parameters Name Type Description cdxmlStr string the CDXML string error string the error message if some exceptions occur © Copyright 1998-2018 PerkinElmer Informatics, Inc. All rights reserved. 45 of 45
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.4 Linearized : No Page Count : 45 Page Mode : UseOutlines Page Layout : OneColumn Language : en-us Producer : madbuild Create Date : 2018:02:15 16:50:32+05:30 Modify Date : 2018:02:15 16:50:32+05:30 Title : ChemDraw JS 17.1 API Reference Guide Author : PKI Documentation Team Subject :EXIF Metadata provided by EXIF.tools