Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Print/Export functionality (Read 2720 times)
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Print/Export functionality
Apr 7th, 2017 at 11:07am
Print Post  
I need to print my diagram and also need to export to pdf? How can i achieve it?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Print/Export functionality
Reply #1 - Apr 7th, 2017 at 11:44am
Print Post  
The browser itself can print the diagram, you might only want to load it alone in its own window as part of the print process and call print on that window. See an example here -
http://mindfusion.eu/Forum/YaBB.pl?num=1410270984/1#1

You could use same toDataURL method to get the diagram image bytes and send them to a 3rd party PDF generation library to include as image in PDF document.

There are PdfExporter classes that export as vector graphics, included with Mindfusion diagram libraries for other platforms such as ASP.NET /MVC and Java. If you can use these runtimes on your server, you could send saved Json or Xml and load it into the exporter to get PDF file.
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Print/Export functionality
Reply #2 - Apr 10th, 2017 at 9:20am
Print Post  
Can we print the diagram in pdf at client side?
Also please let me know how can we add the zooming functionality in diagram?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Print/Export functionality
Reply #3 - Apr 10th, 2017 at 10:15am
Print Post  
Quote:
Can we print the diagram in pdf at client side?


Not via diagramming.js features. You could maybe install a PDF printer to get PDFs from print, or look for a 3rd party PDF library that implements the canvas context2d API to create PDFs.

Quote:
Also please let me know how can we add the zooming functionality in diagram?


Set the ZoomFactor property from e.g. a slider control or mouse-wheel event handler, or use a ZoomControl instance to get a ready-made UI for zooming.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Print/Export functionality
Reply #4 - Apr 11th, 2017 at 11:52am
Print Post  
We didn't have Typescript definitions for ZoomControl; attached d.ts adds them.
  

jsdiag_dts.zip ( 28 KB | 149 Downloads )
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint