打开文件

## 打开服务端文件 //导入头文件 #import <Wellsign_ReaderSDK/Wellsign_ReaderSDK.h> - 接口说明: ``` /// 初始化pdfv-view /// @param frame 位置 /// @param config 配置参数 ( 具体配置参考示例代码 ) /// @param layoutDirection 翻页模式 ( 横向/竖屏, 默认横屏 ) /// @param progress 加载进度 /// @param block 回调 + (void)initWithFrame:(CGRect)frame config:(WSSDKOConfig *_Nonnull)config layoutDirection:(WSLayoutDirection)layoutDirection progress:(void (^_Nonnull)(float progress))progress block:(void(^_Nonnull)(BOOL success, WS_PDFView *_Nullable view, NSString *_Nonnull msg))block; ``` - 调用示例: ``` //打开线上文件 WSSDKOConfig *config = [[WSSDKOConfig alloc] init]; config.signInfos = @"rTQuL2ivYTQ,WXiBdbNyXz5";//多文件就,隔开 config.signerId = @"007"; config.signerName = @"好签iOS"; config.signerDesc = @"这是描述"; config.deviceType = 3; //类型写死 3: iOS config.showMoreFileControl = NO;//是否显示多文件切换的控件(多文件设置有效) // [WSMessageTip showWait:@"正在加载..."]; [WS_PDFView initWithFrame:CGRectMake(0, WS_NAVIGATION_BAR_HEIGHT, KScreenWidth, KScreenHeight-WS_NAVIGATION_BAR_HEIGHT) config:config layoutDirection:wskHorizontal progress:^(float progress) { NSLog(@"进度:%f", progress); } block:^(BOOL success, WS_PDFView * _Nullable view, NSString * _Nonnull msg) { // [WSMessageTip showSuccessMessage:@"success"]; if (success) { view.pdfDelegate = self; self.pdfView = view; [self.view addSubview:view]; [self initNavView]; [self initToolBar]; // //隐藏签名控件的旋转按钮 // [self.pdfView WS_Method_hideSignRoateButton:YES]; // //设置签名控件的初始宽高比(横屏有效) // NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // [dateFormatter setDateFormat:@"M/d "]; // NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; // [dateFormatter1 setDateFormat:@"yyyy/M/d "]; // NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init]; // [dateFormatter2 setDateFormat:@"yyyy/M/d hh:mm:ss"]; // //设置插入签名的参数(一次有效) // [self.pdfView WS_Method_setSignTopLeft:0.4 left:0.4 width:0.2 height:0.2 autoInsertDate:YES dateFormaters:@[dateFormatter,dateFormatter1,dateFormatter2] position:0 margin:10]; // // 设置文本控件 默认参数(横屏有效) // [self.pdfView WS_Method_setTextTopLeft:0 left:0 DefaultFontSize:5 defaultWidth:0.3 defaultIndent:2]; // 隐藏文本控件的转90°按钮 // [self.pdfView WS_Method_hideText90Button:YES]; // [self.pdfView WS_Method_hideSign90Button:YES]; // [self.pdfView WS_Method_hideSignTimeButton:YES]; [view mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(WS_NAVIGATION_BAR_HEIGHT); make.left.right.mas_equalTo(0); if(WS_IS_IPHONE_X_STYLE){ make.bottom.mas_equalTo(-83); }else{ make.bottom.mas_equalTo(-49); } }]; } else { [self.navigationController popViewControllerAnimated:YES]; } }]; ``` ## 本地文件 ``` //打开本地文件: 上传新文件 + 打开. WSSDKOConfig *config = [[WSSDKOConfig alloc] init]; config.signerId = @"007"; config.signerName = @"好签iOS"; config.signerDesc = @"这是描述"; config.deviceType = 3; //类型写死 3: iOS [WSMessageTip showWait:@"打开本地文件..."]; [WS_PDFView openLocalFile:self.localFilePath frame:CGRectMake(0, WS_NAVIGATION_BAR_HEIGHT, KScreenWidth, KScreenHeight-WS_NAVIGATION_BAR_HEIGHT) config:config layoutDirection:wskHorizontal progress:^(float progress) { NSLog(@"上传文件的进度:%f", progress); } block:^(BOOL success, WS_PDFView * _Nullable view, NSString * _Nonnull msg) { [WSMessageTip showSuccessMessage:@"success"]; if (success) { view.pdfDelegate = self; self.pdfView = view; [self.view addSubview:view]; [self initNavView]; [self initToolBar]; [view mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(WS_NAVIGATION_BAR_HEIGHT); make.left.right.mas_equalTo(0); if(WS_IS_IPHONE_X_STYLE){ make.bottom.mas_equalTo(-83); }else{ make.bottom.mas_equalTo(-49); } }]; } else { [self.navigationController popViewControllerAnimated:YES]; } }]; ```