File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change 1- using System . IO ;
1+ using System ;
2+ using System . IO ;
23using System . Windows . Controls ;
34using System . Windows . Media ;
5+ using System . Windows . Threading ;
46using QuickLook . Plugin . PDFViewer ;
57using Syncfusion ;
68using Syncfusion . OfficeChartToImageConverter ;
@@ -89,22 +91,27 @@ private static Control OpenPowerpoint(string path)
8991
9092 var settings = new PresentationToPdfConverterSettings
9193 {
92- OptimizeIdenticalImages = true , ShowHiddenSlides = true
94+ OptimizeIdenticalImages = true ,
95+ ShowHiddenSlides = true
9396 } ;
9497
9598 var pdf = PresentationToPdfConverter . Convert ( ppt , settings ) ;
9699
97100 var viewer = new PdfViewerControl ( ) ;
98- using ( var tempPdf = new MemoryStream ( ) )
99- {
100- pdf . Save ( tempPdf ) ;
101- pdf . Close ( true ) ;
102101
103- ppt . Close ( ) ;
102+ var tempPdf = new MemoryStream ( ) ;
103+ pdf . Save ( tempPdf ) ;
104+ pdf . Close ( true ) ;
105+ pdf . Dispose ( ) ;
106+ ppt . Close ( ) ;
107+ ppt . Dispose ( ) ;
104108
109+ viewer . Dispatcher . BeginInvoke ( new Action ( ( ) =>
110+ {
105111 viewer . LoadPdf ( tempPdf ) ;
106- }
107-
112+ tempPdf . Dispose ( ) ;
113+ } ) , DispatcherPriority . Loaded ) ;
114+
108115 return viewer ;
109116 }
110117 }
You can’t perform that action at this time.
0 commit comments