-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to programmatically save the svg map ? #149
Comments
The new SVG output is available via "Save as" -> "Image" -> "SVG".
The app has no "programmatic" entrypoint, so you cannot really control it without using the UI. But you are free to adjust the app by modifying the source code and re-building, creating your own customized version (to be hosted on your own server/domain). You are then of course able to render the map without displaying it and generate the SVG output accordingly. I am not 100% sure what user story / flow are you aiming for here; if you describe it in more detail, I can provide more detailed hints. |
Thanks for this quick answer. I will try to be clearer I would like to use the UI. When clicking on my own button "save" of the UI, thanks to your advices #137, I can already get the map in json format and save it. It works perfectly to store the json map into a database. But in the same time, I need to generate the saved map in png format and store this file on the server. This png file will be included into a generated pdf for printing when the user clicks on another UI button "print". Then, I would like the app to generate the svg/png datas, so that I can crop it to send it with ajax to a php script. this script will record the corresponding svg/png file on the server. All this without parameters to be entered by the user (all should be transparent, the user just click on a "save" button) |
I see. The "image" backend is currently only offering the resulting image data as download. I will update it so that you can use it to get the data via a JS call. |
Please try updating to master now. The following should do the trick: import { repo as formatRepo } from "./format/format.js";
let imageBackend = formatRepo.get("image");
let imageUrl = await imageBackend.save("svg"); // or "png" Note that:
If you want image data, you will have to create an HTML image and make it load the given URL. |
ondras#149 image backend exposes src
Hi Ondras, thanks to this quick answer. With your advices, here is what i've made, as a complement to the #137 post. It creates a class wich allows a button to save the map under three differents formats at the same time If it can help anybody. // ========================================== new class saveDirect extends Command {
} // ========================================== function mindmap_save(str, png_src, svg_src) { var formData = new FormData();
} //==============
|
Hi Ondras,
For printing reasons, I have to store the mindmap in a svg format (or png or something else).
Is there a way to get the svg / png / gif format of the mindmap with your new coding ?
If so, is it possible to generate this image without displaying the map on the screen ?
Thanks for your answer
The text was updated successfully, but these errors were encountered: