密码字段在受密码保护的pdf上不可见 [英] Password field not visible on password protected pdf
本文介绍了密码字段在受密码保护的pdf上不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用PDF套件框架来显示/编辑pdf文件.它在macOS 10.12上严重损坏.有时受密码保护的文件不显示密码字段,而有时在普通文件中可见密码字段.
I am using PDF kit framework to display/Edit pdf files. Its broken badly on macOS 10.12. Sometimes password protected files do not display password field and sometimes password field is visible in normal file.
推荐答案
我能够使用未公开的API来解决此问题.其问题与隐藏/取消隐藏密码视图有关.
I am able to fix this using undocumented APIs. Its issue related to hide/unhide password view.
/*
From class dump of pdf kit
@interface PDFPasswordViewController : NSViewController
{
NSTextField *_passwordField;
NSTextField *_passwordPrompt;
NSTextField *_passwordInstruction;
NSView *_passwordView;
PDFView *_pdfView;
}
- (void).cxx_destruct;
- (void)_commonInit;
- (void)passwordEntered:(id)arg1;
- (void)setPDFView:(id)arg1;
- (void)loadView;
@end
*/
/*
@private
PDFViewPrivate* _private;
Available in PDFView.h file
*/
id PDFViewPrivate = [self.pdfView valueForKey:@"_private"];
if (PDFViewPrivate)
{
NSViewController *passwordViewController = [PDFViewPrivate valueForKey:@"passwordViewController"];
NSView *passwordView = [passwordViewController valueForKey:@"_passwordView"];
if (self.pdfView.document.isLocked)
{
NSTextField *passwordField = [passwordViewController valueForKey:@"_passwordField"];
// Reset last password
[passwordField setStringValue:@""];
// Add password view
passwordView.hidden = NO;
}
else
{
passwordView.hidden = YES;
}
}
PDFPasswordViewController
仅在10.12上可用
PDFPasswordViewController
is only available on 10.12
这篇关于密码字段在受密码保护的pdf上不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文