Hello,
We would like to render molfiles on client side by using Ketcher with read only mode
Currently, in the example 'demo.html', we need to press « Render Now » button to display the structure.
Is there a way/workaround to render the molfile in the HTML table on the page loading (e.g. without the « Render Now » button)?
We try to call the JS ‘render’ function after the HTML table without success;
It seems to be a issue with the Ketcher iframe loading.
You’ll find in attachement an example 'demo_dng.html'
Thanks for your help and support.
Regards,
Grégory.
--
Hi,
I'm trying out Ketcher and it is great so far. However, I have the same problem when trying to render molfiles in a report.
By following the previous examples the picture is actually displayed with the static <p> tag 'molfile', but it doesn't work if the molfile is generated by a pl/sql function called up-front.
I have tried using '<br/>', '\n', and '' to build the molfile as if it was written in plain text in the <p> tag, but it still doesn't seem to be the write format for Ketcher.
Could you please tell me were I went wrong (example attached) ?
Thanks for your help and support.
Regards,
Shakti
ketcher.showMolfileOpts = function (clientArea, molfileText, bondLength, opts, viewSz){this.render = new rnd.Render(clientArea, bondLength, opts, viewSz);...
Hi Mikhail,
First of all thank you for your quick answer.
The rendering problem is solved : in fact there is already a windows type newline character (chr10) in my data, so adding an extra character was the problem. Although, the structure still could'nt be seen in the table cell because it was too large. I changed the third showMolfileOpts parameter from 100 to 20 to get a smaller picture that could actually be seen in the table cell.
Thus I still have a question : since the autoscale doesn't seem to be applied properly, could you tell me where I can find more information about the showMolfileOpts parameters ?
Thank you,
Shakti
Hi again,
Thanks for the reactivity !
I have tried your solution of adding a parameter to the showMolfileOpts function in ketcher.js and changing the way it is called by :
ketcher.showMolfileOpts('textarea_634_191', $('mf_634_191').innerHTML, 0, {'autoscale':true,'ignoreMouseEvents':true, 'autoScaleMargin':20}, {x: 300, y: 300});
Now, the structure is centered in the table cell, but still way too big (example attached) ! In fact, changing the size of the autoScaleMargin, or the x and y parameters, does'nt seem to be taken in account and the picture remains the same. Maybe there is a last parameter to add to force the autoscaling ?
Cheers,
Shakti
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/raphael/raphael.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/dist/raphael.min.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/dist/prototype-min.js' %}"></script>
<!--<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/rename-function-calls/node_modules/esprima-fb/test/module.js' %}"></script>-->
<script type="text/javascript" src="{% static 'molbank/ketcher/Gruntfile.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/crypto-browserify/example/bundle.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/jshint/dist/jshint.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/@browserify/acorn5-object-spread/inject.js' %}"></script>
<!--<script type="text/javascript" src="{% static 'molbank/ketcher/node_modules/watchify/node_modules/browserify/example/source_maps/js/build/bundle.js' %}"></script>-->
<script type="text/javascript" src="{% static 'molbank/ketcher/script/util/index.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/util/vec2.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/util/set.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/util/map.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/util/pool.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/element.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/sgroup.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/struct.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/struct_valence.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/molfile.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/dfs.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/chem/smiles.js' %}"></script>
<!--<script type="text/javascript" src="{% static 'molbank/ketcher/script/rnd/events.js' %}"></script>-->
<script type="text/javascript" src="{% static 'molbank/ketcher/script/rnd/visel.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/rnd/restruct.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/rnd/restruct_rendering.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/script/rnd/render.js' %}"></script>
<script type="text/javascript" src="{% static 'molbank/ketcher/dist/ketcher.js' %}"></script>