Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

export image problem #249

Closed
lijingjian001 opened this issue Sep 6, 2018 · 6 comments
Closed

export image problem #249

lijingjian001 opened this issue Sep 6, 2018 · 6 comments

Comments

@lijingjian001
Copy link

When I export a image from the xml of the graph that cell value is html. The superise is come. Someboy can help me!
graph 1

@davidjgraph
Copy link
Contributor

Please submit a bug report.

@lijingjian001
Copy link
Author

It's not a bug,the xml is generated from web,but the image it's exported from webserver.The server don't have the proper to deal the xml has html.

@davidjgraph
Copy link
Contributor

So, what is your question?

@lijingjian001
Copy link
Author

Is there a mature way to process mxgraph's XML that contains HTML into pictures?

@ekoz
Copy link

ekoz commented Mar 19, 2019

Is there a mature way to process mxgraph's XML that contains HTML into pictures?

Hi, u can read demo mxgraph/examples/web/ExportServlet.java to exprot img.

I try to export img which mxgraph node contains html, it's work ok. my code is here:

var xmlDoc = mxUtils.createXmlDocument();
var root = xmlDoc.createElement('output');
xmlDoc.appendChild(root);

var xmlCanvas = new mxXmlCanvas2D(root);
var imgExport = new mxImageExport();
imgExport.drawState(graph.getView().getState(graph.model.root), xmlCanvas);

var bounds = graph.getGraphBounds();
var w = Math.ceil(bounds.x + bounds.width + 10);
var h = Math.ceil(bounds.y + bounds.height + 10);

var xml = mxUtils.getXml(root);
new mxXmlRequest($.kbase.ctx + '/export.do?t=' + (new Date()).getTime(), 'format=png&w=' + w +
    '&h=' + h + '&bg=#F9F7ED&xml=' + encodeURIComponent(xml))
    .simulate(document, '_blank');

the result is:
1552966373945

@kvanapal
Copy link

I cannot find the java class mxImageExport in the source. Am i missing something?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants