diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-02-17 13:45:02 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-02-17 13:45:02 +0300 |
commit | e495105f25efd2b401c79a1be1b2abd0264b4226 (patch) | |
tree | b4386cefc590345e669dddee95c326feab17084c /DHTMLX.Export.PDF/PDFImages.cs | |
download | scheduler-export-net-master.zip scheduler-export-net-master.tar.gz scheduler-export-net-master.tar.bz2 |
[add] initial commitHEADorigin/masterorigin/HEADmaster
Diffstat (limited to 'DHTMLX.Export.PDF/PDFImages.cs')
-rw-r--r-- | DHTMLX.Export.PDF/PDFImages.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/DHTMLX.Export.PDF/PDFImages.cs b/DHTMLX.Export.PDF/PDFImages.cs new file mode 100644 index 0000000..8411f37 --- /dev/null +++ b/DHTMLX.Export.PDF/PDFImages.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.IO; +using PdfSharp.Drawing; +using System.Drawing; + +using DHTMLX.Export.PDF.Scheduler; +namespace DHTMLX.Export.PDF.Scheduler +{ + public class PDFImages + { + + private Dictionary<string, XImage> _cache = new Dictionary<string, XImage>(); + public XImage Get(string path) + { + if (_cache.ContainsKey(path)) + { + return _cache[path]; + } + + if (File.Exists(path)) + { + FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); + var img = new Bitmap(fileStream, false); + _cache.Add(path, (XImage)img); + + return _cache[path]; + } + + return null; + } + + } +} |