mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
QL will display a UI prompting for a password. Upon entering the correct password, the PDF file will be reopened.
This commit is contained in:
@@ -213,13 +213,13 @@ public partial class PdfViewerControl : UserControl, INotifyPropertyChanged, IDi
|
||||
}
|
||||
}
|
||||
|
||||
public static Size GetDesiredControlSizeByFirstPage(string path)
|
||||
public static Size GetDesiredControlSizeByFirstPage(string path, string password = null)
|
||||
{
|
||||
Size size;
|
||||
|
||||
using (var s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
using (var tempHandle = PdfDocument.Load(s))
|
||||
using (var tempHandle = PdfDocument.Load(s, password))
|
||||
{
|
||||
size = new Size(0, 0);
|
||||
tempHandle.PageSizes.Take(5).ForEach(p =>
|
||||
@@ -236,10 +236,10 @@ public partial class PdfViewerControl : UserControl, INotifyPropertyChanged, IDi
|
||||
return new Size(size.Width * 3, size.Height * 3);
|
||||
}
|
||||
|
||||
public void LoadPdf(string path)
|
||||
public void LoadPdf(string path, string password = null)
|
||||
{
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
PdfDocumentWrapper = new PdfDocumentWrapper(stream);
|
||||
PdfDocumentWrapper = new PdfDocumentWrapper(stream, password);
|
||||
_pdfLoaded = true;
|
||||
|
||||
if (PdfDocumentWrapper.PdfDocument.PageCount < 2)
|
||||
|
Reference in New Issue
Block a user