diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs index 2836466..3618974 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs @@ -185,7 +185,7 @@ namespace QuickLook.Plugin.PDFViewer ReRenderCurrentPage(); } - public Size GetDesiredControlSizeByFirstPage(string path) + public static Size GetDesiredControlSizeByFirstPage(string path) { var tempHandle = new PdfFile(path); diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs index 0eee92f..1542e09 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs @@ -19,17 +19,16 @@ namespace QuickLook.Plugin.PDFViewer if (File.Exists(path) && Path.GetExtension(path).ToLower() == ".pdf") return true; - using (var br = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) - { - return Encoding.ASCII.GetString(br.ReadBytes(4)) == "%PDF"; - } + //using (var br = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) + //{ + // return Encoding.ASCII.GetString(br.ReadBytes(4)) == "%PDF"; + //} + return false; } public void Prepare(string path, ContextObject context) { - _pdfControl = new PdfViewerControl(); - - var desiredSize = _pdfControl.GetDesiredControlSizeByFirstPage(path); + var desiredSize = PdfViewerControl.GetDesiredControlSizeByFirstPage(path); context.SetPreferredSizeFit(desiredSize, 0.8); }