public void SaveAsPDF(string filename, Stream chartStream, SfChart chart, PdfDocument document)
{
….
finally
{
…
if (((Com.Syncfusion.Charts.SfChart)nativeChart).Parent != null)
{
(((Com.Syncfusion.Charts.SfChart)nativeChart).Parent as ViewGroup).RemoveAllViews();
}
..
}
} |
[assembly: Dependency(typeof(ChartToPdfExample.Droid.ExportChartToPdf))]
namespace ChartToPdfExample.Droid
{
class ExportChartToPdf : IChartDependencyService
{
…
}
} |
if (((Com.Syncfusion.Charts.SfChart)nativeChart).Parent != null)
{
(((Com.Syncfusion.Charts.SfChart)nativeChart).Parent as ViewGroup).RemoveAllViews();
}
|
public void SaveAsPDF(Stream chartStream, SfChart chart, PdfDocument document)
{
……
try
{
var page = document.Pages.Add();
var graphics = page.Graphics;
graphics.DrawImage(PdfImage.FromStream(chartStream), 0, 0, page.GetClientSize().Width,
page.GetClientSize().Height);
MemoryStream stream = new MemoryStream();
document.Save(stream);
SavePDF(stream, chart);
}
……
} |