Skip to content

Commit

Permalink
Fix #2: failure caused by PDFViewer change
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Sep 16, 2018
1 parent 566dfab commit 40e8d15
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions SyncfusionControl.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.IO;
using System;
using System.IO;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using QuickLook.Plugin.PDFViewer;
using Syncfusion;
using Syncfusion.OfficeChartToImageConverter;
Expand Down Expand Up @@ -89,22 +91,27 @@ private static Control OpenPowerpoint(string path)

var settings = new PresentationToPdfConverterSettings
{
OptimizeIdenticalImages = true, ShowHiddenSlides = true
OptimizeIdenticalImages = true,
ShowHiddenSlides = true
};

var pdf = PresentationToPdfConverter.Convert(ppt, settings);

var viewer = new PdfViewerControl();
using (var tempPdf = new MemoryStream())
{
pdf.Save(tempPdf);
pdf.Close(true);

ppt.Close();
var tempPdf = new MemoryStream();
pdf.Save(tempPdf);
pdf.Close(true);
pdf.Dispose();
ppt.Close();
ppt.Dispose();

viewer.Dispatcher.BeginInvoke(new Action(() =>
{
viewer.LoadPdf(tempPdf);
}

tempPdf.Dispose();
}), DispatcherPriority.Loaded);

return viewer;
}
}
Expand Down

0 comments on commit 40e8d15

Please sign in to comment.