Convert mxGraphModel XML to PNG on server side - mxgraph

I'm trying to integrate mxGraph in a small project and I would like to convert XML-files (with a mxGraphModel conatiner in it) stored on the server to PNG and PDF (and serve them as download).
I have the XML files on the server ready, but i can't find a possibility to convert them on server side (in a JAVA surflet) to PNG.
Here a sample XML-File:
<mxGraphModel>
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="Hello" parent="1" vertex="1">
<mxGeometry x="20" y="20" width="80" height="30" as="geometry"/>
</mxCell>
<mxCell id="3" value="World" parent="1" vertex="1">
<mxGeometry x="200" y="150" width="80" height="30" as="geometry"/>
</mxCell>
<mxCell id="4" value="" parent="1" source="2" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
Is there a way to do this on the server side ?
Best Regards,
Jens

I recently did this using :
the Xml2Svg demo program included in the draw.io source code, it converts mxgraph xml to svg file. Be carreful simple shapes are converted well, but not complex draw.io custom shapes
Batik library to convert svg to a PNG file
PS : I also included this process into a mvn pdf:pdf custom Mojo with no success : the Batik library are in conflict between Batik and the pdf mojo
Didier

Related

rendering xml (reversing pdftohtml)

I have a document (shown below), created with pdftohtml (linux package/command). It has enough information to render a page. For example, see the page's height & width attributes. Also some textboxes with coordinates. I am thinking how should I approach the task of rendering it back to a readable, pdf-like view. Appreciate any pointer.
<page number="112" position="absolute" top="0" left="0" height="992" width="756">
<text top="78" left="108" width="540" height="21" font="22">This configures networking routes such that you have unique IP addresses assigned</text>
<text top="98" left="108" width="118" height="21" font="22">to every service of </text>
<text top="101" left="226" width="135" height="15" font="25">type: LoadBalancer</text>
<text top="98" left="360" width="4" height="21" font="22">.</text>
<text top="132" left="108" width="127" height="28" font="33"><b>Configuring DNS</b></text>
</page>
The whole point is it should be a HTML view.
So for example I print this Page to a PDF (Top) and run the pdftohtml command I get the output (Middle) with lower browser HTML view.
Now I can print to PDF again, However there are penalties for round tripping PDF some links will work but not other links (like that package one), or some other objects NOTE the line starting "Also" may need co-ordinate re-adjustments. Most easily after correction you could use a single command line to Chrome/Edge --headless "Print-to-PDF in place of my manual reprint.

i am new to krpano i want to add video but i dont know hot to ddo that can anyone suggest me from scratch thank you?

i am very hopefull that i got answer from this developer around the world
There is a video player plugin for Krpano.
Add this to your tour.xml file.
As 3d distorted hotspot:
<hotspot name="video"
url.flash="videoplayer.swf"
url.html5="videoplayer.js"
videourl="video.m4v|video.webm"
posterurl="videoposter.jpg"
ath="0.0" atv="0.0"
distorted="true"
scale="1.0"
rx="0.0"
ry="0.0"
rz="0.0"
pausedonstart="false"
loop="false"
volume="1.0"
directionalsound="true"
range="90.0"
rangefalloff="1.0"
outofrangevolume="0.0"
onvideoready=""
onvideoplay=""
onvideopaused=""
onvideocomplete=""
onerror=""
/>
As a flat layer element on the screen:
<layer name="video"
url.flash="videoplayer.swf"
url.html5="videoplayer.js"
videourl="video.m4v|video.webm"
posterurl="videoposter.jpg"
align="center" x="0" y="0"
pausedonstart="false"
loop="false"
volume="1.0"
onvideoready=""
onvideoplay=""
onvideopaused=""
onvideocomplete=""
onerror=""
/>
Please see here in the Krpano documentation for more information on how to control this plugin.

How to print html content to a PDF with jasper reports?

I'm using Primefaces 5.3 in a web app along with the Primefaces <p:editor> which saves its data to a database table. I would like to export/print to PDF the value data from the database with the format being ready instead of printing out codes like
<br> or <ul> <li>, etc.
I'm using Jasper reports to create the report and then exporting to pdf, so I need to create "something" that can be printed with jasper reports that will take care of the html codes.
You can use the HtmlComponent <hc:html/>
Example
<componentElement>
<reportElement x="0" y="100" width="230" height="110" backcolor="#ADD8E6" uuid="332dd551-e8cd-4cb0-a11f-7325f481017b"/>
<hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="FillFrame" horizontalAlign="Left" verticalAlign="Top">
<hc:htmlContentExpression><![CDATA["Hello<br/>World"]]></hc:htmlContentExpression>
</hc:html>
</componentElement>
It will generate an image of your html.

Position setting in XML or Database

I am trying to figure out what the best approach to store images and texts position in the database or XML file (simple and easy to maintain as possible)?
For example, in the canvas user can choose a image file and the position on the canvas.
If I use XML file there will be some defined tags name, something like this:
<template name="Template Name">
<canvas background="background.jpg">
<ratings>
<area x="710" y="150" width="430" height="500" margin="20" image="panel.png" >
<columns>1</columns>
<rows>8</rows>
</area>
<text font="ScoutCond Bold" size="22" case="upper" style="bold" color="#777777" />
</ratings>
</canvas>
</template>
<area> represents the location and size of the area where ratings are displayed.
<columns> and should be easy to understand!

How can I load something from MySQL to an HorizontalList in Flex

How can I load text from MySQL to an HorizontalList in Flex3 ?
I am using :
<mx:ControlBar x="10" y="40" width="460" height="230">
<mx:HorizontalList id="dataGrid"
dataProvider="{dataArr}"
labelField="lbl"
iconField="src"
itemRenderer="CustomItemRenderer"
columnCount="4"
columnWidth="100"
rowHeight="100"
horizontalScrollPolicy="on"
width="439" height="230"/>
</mx:ControlBar>
And in the CustomItemRenderer.mxml
<mx:VBox horizontalAlign="center" verticalAlign="middle">
<mx:Image source="{data.#thumbnailImage}" />
<mx:Label text="{data.#nomept}" />
</mx:VBox>
I also did the "Create Application from Database.." and tried to integrate with the success but with no success.
You need to use a "server side solution" such as php / rails / python / cf / etc... in order to get the mySQL data to Flex.
You can't execute mySQL queries directly from actionscript/flex, if you where using Adobe AIR, you could communicate with sqlite3
Cheers