Skip to content

Commit a8b5180

Browse files
committed
Fix Webview2 persist and width #3 #4
1 parent 372d9bc commit a8b5180

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

QuickLook.Plugin.PdfViewer-Native/Helper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2021 Paddy Xu and Frank Becker
1+
// Copyright © 2017-2025 QL-Win Contributors
22
//
33
// This file is part of QuickLook program.
44
//

QuickLook.Plugin.PdfViewer-Native/Plugin.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2024 ema
1+
// Copyright © 2017-2025 QL-Win Contributors
22
//
33
// This file is part of QuickLook program.
44
//
@@ -25,6 +25,9 @@ namespace QuickLook.Plugin.PDFViewerNative;
2525

2626
public class Plugin : IViewer
2727
{
28+
private static double _width = 1000;
29+
private static double _height = 1200;
30+
2831
public int Priority => 1;
2932

3033
private WebpagePanel _panel;
@@ -44,7 +47,7 @@ public bool CanHandle(string path)
4447

4548
public void Prepare(string path, ContextObject context)
4649
{
47-
context.PreferredSize = new Size(1280, 720);
50+
context.SetPreferredSizeFit(new Size(_width, _height), 0.9d);
4851
}
4952

5053
public void View(string path, ContextObject context)
@@ -59,6 +62,12 @@ public void View(string path, ContextObject context)
5962

6063
public void Cleanup()
6164
{
65+
_width = _panel.ActualWidth;
66+
_height = _panel.ActualHeight;
67+
68+
_panel?.Dispose();
69+
_panel = null;
70+
6271
GC.SuppressFinalize(this);
6372
}
6473
}

QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2021 Paddy Xu and Frank Becker
1+
// Copyright © 2017-2025 QL-Win Contributors
22
//
33
// This file is part of QuickLook program.
44
//

0 commit comments

Comments
 (0)