We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to get export working for the diagram control

Thread ID:

Created:

Updated:

Platform:

Replies:

148263 Oct 12,2019 06:54 AM UTC Oct 15,2019 06:17 AM UTC Vue 3
loading
Tags: Diagram
Daniel
Asked On October 12, 2019 06:54 AM UTC

Hi all,

We are currently using Syncfusion's diagram control on a Nuxt web app. We have been able to get most of the features we want working so far except for the ability to export the diagram as an image. In our methods section of the script part of the page, we have the following method:

    exportPDF() {
      let diagramObj = document.getElementById('diagram')
      let diagramInstance = diagramObj.ej2_instances[0]
      let exportOptions = {}
      exportOptions.mode = 'Download'
      exportOptions.format = 'PDF'
      exportOptions.region = 'PageSettings'
      exportOptions.fileName = 'Export'
      exportOptions.pageHeight = 400
      exportOptions.pageWidth = 400
      diagramInstance.exportDiagram(exportOptions)
    },

This is called by a button. Nothing seems to happen when this method is called though. Is there something we are doing wrong in our code?

Thank you

Shyam G [Syncfusion]
Replied On October 14, 2019 05:38 AM UTC

Hi Daniel, 
 
To use Print and Export, you need to inject PrintAndExport module in the diagram. Please refer to a code example below. 
 
Code example: 
import {  
  PrintAndExport,  
} from "@syncfusion/ej2-vue-diagrams"; 
 
//inject diagram printandexport 
Diagram.Inject(PrintAndExport); 
 
 
You have set an incorrect value for the format in your code example. We should set image format as jpg, png, bmp to export diagram to image. We modified your code example and included a sample for your reference. 
 
Code example: 
methods: { 
     exportDiagram: function (event) { 
      let exportOptions = {} 
      exportOptions.mode = 'Download' 
      exportOptions.format = 'jpg' 
      exportOptions.region = 'PageSettings' 
      exportOptions.fileName = 'Export' 
      exportOptions.pageHeight = 400 
      exportOptions.pageWidth = 400 
      diagramInstance.exportDiagram(exportOptions) 
     } 
  } 
 
 
 
  
Regards, 
Shyam G  


Daniel
Replied On October 15, 2019 02:06 AM UTC

Hi Shyam,

Thank for your reply, I was able to get it working with your help.

Regards,
Daniel

Shyam G [Syncfusion]
Replied On October 15, 2019 06:17 AM UTC

Hi Daniel, 
Thanks for your update. 
Regards, 
Shyam G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon