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 download the diagram in diagram component

Hi,

I tried to call exportDiagram in diagram with the below option but unable to download.

const options: IExportOptions = { fileName: 'diagram', format: 'PNG',
  mode: 'Download', type: 'image', region: 'PageSettings' };
const diagram = document.getElementById('diagramPanel');
diagram.ej2_instances[NUMBER0].exportDiagram(options);

When i tried to debug, was able to see that this.printandExportModule condition in diagram.js was undefined.

Could you please suggest if any other data has to be set apart from the above code?

Regards,
Sudhanshu

5 Replies

SG Shyam G Syncfusion Team October 17, 2019 09:25 AM UTC

Hi Sudhanshu, 
 
To use print and export, we need to inject PrintAndExport Module in the application. Please refer to a code example, sample and help documentation. 
 
Code example: 
//inject print and export module 
Diagram.Inject(PrintAndExport) 
 
 
 
The diagram component is divided into individual feature-wise modules. In order to use a particular feature, inject the required module. please refer to the below help documentation for more details. 
 
 
Regards, 
Shyam G 



SJ Sudhanshu Jain November 5, 2019 03:32 PM UTC

Hi Shyam,

I tried the solution you have provided, but only a part of diagram is getting captured in the downloaded image. Is there any other attribute to be set along?

Regards,
Sudhanshu


SG Shyam G Syncfusion Team November 6, 2019 12:46 PM UTC

Hi Sudhanshu, 
 
If you have set export arguments multiplePage as true, then the multiple image files will be downloaded based on the diagram content and if it is false, the diagram content will be scaled and exported as a single image file. Could you please check in the below sample?. Also, please check whether your browser blocks downloading the multiple files. Still if you face issues, please share us more details such as modify the below sample. 
 
 
Regards, 
Shyam G 



SJ Sudhanshu Jain November 7, 2019 05:52 AM UTC

Hi Shyam,

Thanks for the information and sample, could you please confirm if there is any limitation on the size(i.e. max width or height) of the workflow within the canvas which can be captured as png?

Regards,
Sudhanshu


SG Shyam G Syncfusion Team November 8, 2019 04:09 AM UTC

Hi Sudhanshu, 
 
There is no limitation on the size of the workflow. You can export workflow of larger size. 
 
Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon