Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149645 | Dec 4,2019 10:55 AM UTC | Dec 5,2019 12:41 PM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: PDF |
//Create PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the image from the disk
FileStream imageStream = new FileStream("pie_chart.png", FileMode.Open, FileAccess.Read);
PdfBitmap image = new PdfBitmap(imageStream);
//Draw the image
graphics.DrawImage(image, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
//Saving the PDF to the MemoryStream
MemoryStream stream = new MemoryStream();
doc.Save(stream); |
<ejs-accumulationchart id="container" title="Mobile Browser Statistics" load="load"enableAnimation="false">
<e-accumulationchart-center x="50%" y="50%"></e-accumulationchart-center>
<e-accumulationchart-tooltipsettings enable="true"></e-accumulationchart-tooltipsettings>
<e-accumulationchart-legendsettings visible="false">
</e-accumulationchart-legendsettings>
<e-accumulation-series-collection>
<e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue"yName="yValue" name="Browser" explodeIndex="0" explode="true"explodeOffset="10%">
<e-accumulationseries-datalabel name="text" visible="true">
<e-font fontWeight="600" color="white"></e-font>
</e-accumulationseries-datalabel>
</e-accumulation-series>
</e-accumulation-series-collection>
</ejs-accumulationchart>
<div>
<ejs-button id="button" content="Export" iconCss="e-icons e-play-icon" cssClass="e-flat" isPrimary="true"></ejs-button>
</div>
<script>
document.getElementById('button').onclick = () => {
var chart = document.getElementById('container').ej2_instances[0];
chart.exportModule.export('PDF', 'chart', 'Landscape', [chart] null, 1600);
};
</script> |
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.
This page will automatically be redirected to the sign-in page in 10 seconds.