private static PdfDocument Load(IWin32Window owner, Stream stream, string password) { try { while (true) { try { return(new PdfDocument(stream, password)); } catch (PdfException ex) { if (owner != null && ex.Error == PdfError.PasswordProtected) { using (var form = new PasswordForm()) { if (form.ShowDialog(owner) == DialogResult.OK) { password = form.Password; continue; } } } throw; } } } catch { stream.Dispose(); throw; } }
private static PdfDocument Load(IWin32Window owner, Stream stream, string password) { try { while (true) { try { return new PdfDocument(stream, password); } catch (PdfException ex) { if (owner != null && ex.Error == PdfError.PasswordProtected) { using (var form = new PasswordForm()) { if (form.ShowDialog(owner) == DialogResult.OK) { password = form.Password; continue; } } } throw; } } } catch { stream.Dispose(); throw; } }