Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

Closed Unassigned: ToPdf extension method [10172]

$
0
0
The PlotModel has the ToSvg method. I was searching for the pdf export functionality and had to use one of the examples to find out how to do this.

I think it would be great if a small extension method could be added:

```
public static byte[] ToPdf(this PlotModel plotModel)
{
Argument.IsNotNull(() => plotModel);

return ToPdf(plotModel, plotModel.Width, plotModel.Height);
}

public static byte[] ToPdf(this PlotModel plotModel, double width, double height)
{
Argument.IsNotNull(() => plotModel);

using (var memoryStream = new MemoryStream())
{
PdfExporter.Export(plotModel, memoryStream, width, height);

return memoryStream.ToArray();
}
}
```
Comments: Decided to remove ToSvg instead! I think it is better to reduce the number of ways to export to Svg/Pdf. Export is documented at http://oxyplot.org/doc/ExportPdf.html and http://oxyplot.org/doc/ExportSvg.html

Viewing all articles
Browse latest Browse all 2061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>