export to pdf both chart and tabular data

Hi ,

Is it possible to export both syncfusion chart and its data in tabular format in pdf.

5 Replies

DG Durga Gopalakrishnan Syncfusion Team January 12, 2021 05:31 PM UTC

Hi Nikhil,
 
We can draw a chart as jpeg or png image and PDF grid in the same PDF document by using ej2-pdf-library. Please find the sample for this,
 
Sample Link :https://stackblitz.com/edit/typescript-vdpkz1?file=index.ts

//Base64 string of chart as Image
let imageBase64 : string ; -- > base64String of image
let image: PdfBitmap = new PdfBitmap(imageBase64);


Note:Currently, we do not have PDF parsing support in ej2-pdf-library. So, we cannot load an existing PDF and not able to draw image in it. We can only achieve this while creating PDF with same PDF document instance.

Please let us know if you have any concern on this.

Regards,
Durga G



NI Nikhil January 19, 2021 04:39 AM UTC

Hi Durga ,

Thanks for reply .

My use case is as follow :

1. User draws chart using syncfusion donut chart.
2. Now user should be able to export syncfusion angular donut chart with its metadata like id , datasource data .

if you can help on this with example , it is really appreciated.

Regards,
Nikhil Jadhav


Attachment: export_report_37b5cccf.zip


DG Durga Gopalakrishnan Syncfusion Team January 20, 2021 04:22 PM UTC

Hi Nikil,

Sorry for inconvenience. We have validated your reported scenario with attached screenshot. As of now, we don't have support to export multiple controls. We have an option to export multiple charts or multiple grids on single pdf, but we cannot export different controls.


Please revert us if you have any concerns.

Regards,
Durga G



NI Nikhil February 4, 2021 09:57 AM UTC

Hi , 

Any method where we can convert chart into dataurl in angular .


DG Durga Gopalakrishnan Syncfusion Team February 5, 2021 04:16 PM UTC

Hi Nikhil,

Yes, we have an option to get the dataURL of chart image. We have done a workaround to achieve your reported scenario and attached sample for your reference. 

public mode(e: Event): void {
    var svg = document.querySelector("#container_svg");
    var svgData = new XMLSerializer().serializeToString(svg);
    var canvas = document.createElement("canvas");
    document.body.appendChild(canvas);
    var svgSize = svg.getBoundingClientRect();
    canvas.width = svgSize.width;
    canvas.height = svgSize.height;
    var ctx = canvas.getContext("2d");
    var img = document.createElement("img");
    img.setAttribute("src", "data:image/svg+xml;base64," + btoa(svgData));
    img.onload = function() {
      ctx.drawImage(img, 0, 0);
      var imagedata = canvas.toDataURL("image/png");
      console.log(imagedata); // printed base64 in console
      canvas.remove();
    };
  }


Kindly revert us if you have any concerns.

Regards,
Durga G



Loader.
Up arrow icon