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. Image for the cookie policy date

Unable to get export working for the diagram control

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

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

3 Replies

SG Shyam G Syncfusion Team 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 {  
} from "@syncfusion/ej2-vue-diagrams"; 
//inject diagram 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 
Shyam G  

DA Daniel October 15, 2019 02:06 AM UTC

Hi Shyam,

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


SG Shyam G Syncfusion Team October 15, 2019 06:17 AM UTC

Hi Daniel, 
Thanks for your update. 
Shyam G 

Live Chat Icon For mobile
Up arrow icon