File tree 1 file changed +16
-9
lines changed
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 ;
2
3
using System . Windows . Controls ;
3
4
using System . Windows . Media ;
5
+ using System . Windows . Threading ;
4
6
using QuickLook . Plugin . PDFViewer ;
5
7
using Syncfusion ;
6
8
using Syncfusion . OfficeChartToImageConverter ;
@@ -89,22 +91,27 @@ private static Control OpenPowerpoint(string path)
89
91
90
92
var settings = new PresentationToPdfConverterSettings
91
93
{
92
- OptimizeIdenticalImages = true , ShowHiddenSlides = true
94
+ OptimizeIdenticalImages = true ,
95
+ ShowHiddenSlides = true
93
96
} ;
94
97
95
98
var pdf = PresentationToPdfConverter . Convert ( ppt , settings ) ;
96
99
97
100
var viewer = new PdfViewerControl ( ) ;
98
- using ( var tempPdf = new MemoryStream ( ) )
99
- {
100
- pdf . Save ( tempPdf ) ;
101
- pdf . Close ( true ) ;
102
101
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 ( ) ;
104
108
109
+ viewer . Dispatcher . BeginInvoke ( new Action ( ( ) =>
110
+ {
105
111
viewer . LoadPdf ( tempPdf ) ;
106
- }
107
-
112
+ tempPdf . Dispose ( ) ;
113
+ } ) , DispatcherPriority . Loaded ) ;
114
+
108
115
return viewer ;
109
116
}
110
117
}
You can’t perform that action at this time.
0 commit comments