@@ -26,11 +26,18 @@ - (void)viewPDF:(CDVInvokedUrlCommand*)command
26
26
27
27
self.pdfDocument = [[PDFDocument alloc ] initWithData: [self getBase64Data ]];
28
28
29
- self.pdfWebview = [[WKWebView alloc ] initWithFrame: self .webView.bounds];
29
+ /* Get status bar height if visible */
30
+ UIStatusBarManager *manager = [UIApplication sharedApplication ].windows .firstObject .windowScene .statusBarManager ;
31
+ CGFloat height = 0 ;
32
+ if (!manager.statusBarHidden ) {
33
+ height = manager.statusBarFrame .size .height ;
34
+ }
35
+
36
+ self.pdfWebview = [[WKWebView alloc ] initWithFrame: CGRectMake (0 , height, self .webView.bounds.size.width,self .webView.bounds.size.height - height)];
30
37
31
- [self setToolbar ];
38
+ UIToolbar *toolbar = [self setToolbar ];
32
39
33
- self.pdfView = [[PDFView alloc ] initWithFrame: CGRectMake (0 , 50 , self .pdfWebview.bounds.size.width, self .pdfWebview.bounds.size.height - 50 )];
40
+ self.pdfView = [[PDFView alloc ] initWithFrame: CGRectMake (0 , toolbar.bounds.size.height , self .pdfWebview.bounds.size.width, self .pdfWebview.bounds.size.height - toolbar.bounds.size.height )];
34
41
self.pdfView .autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
35
42
self.pdfView .displayMode = [mode integerValue ];
36
43
self.pdfView .displayDirection = [direction isEqual: @" vertical" ] ? kPDFDisplayDirectionVertical : kPDFDisplayDirectionHorizontal ;
@@ -156,7 +163,7 @@ -(UIColor *)colorWithHexString:(NSString *)str_HEX alpha:(CGFloat)alpha_range{
156
163
return [UIColor colorWithRed: red/255.0 green: green/255.0 blue: blue/255.0 alpha: alpha_range];
157
164
}
158
165
159
- -(void )setToolbar {
166
+ -(UIToolbar * )setToolbar {
160
167
161
168
NSString * toolbarColour = [self .command.arguments objectAtIndex: 5 ];
162
169
NSString * doneBtnColour = [self .command.arguments objectAtIndex: 6 ];
@@ -244,7 +251,8 @@ -(void)setToolbar {
244
251
[toolbar setItems: items];
245
252
[self .pdfWebview addSubview: toolbar];
246
253
[self .pdfWebview bringSubviewToFront: toolbar];
247
-
254
+
255
+ return toolbar;
248
256
}
249
257
250
258
-(NSString *)getPath {
@@ -351,7 +359,7 @@ -(void)shareFn:(UIButton* _Nullable)sender base64:(NSData *)data shareText:(NSSt
351
359
activityViewControntroller.popoverPresentationController .sourceView = sender;
352
360
activityViewControntroller.popoverPresentationController .sourceRect = sender.bounds ;
353
361
} else {
354
- activityViewControntroller.popoverPresentationController .sourceView = self.webView ;
362
+ activityViewControntroller.popoverPresentationController .sourceView = self.pdfWebview ;
355
363
activityViewControntroller.popoverPresentationController .sourceRect = CGRectMake (self.pdfWebview .bounds .size .width /2 , self.pdfWebview .bounds .size .height /4 , 0 , 0 );
356
364
}
357
365
@@ -472,6 +480,7 @@ -(void)drawSignBox:(NSString*)titleText annotationKey:(NSString*)fieldName {
472
480
PKInkingTool* tool = [[PKInkingTool alloc ] initWithInkType: PKInkTypePen color: UIColor.blackColor width: 10 ];
473
481
474
482
[self .canvas setTool: tool];
483
+ [self .canvas setAllowsFingerDrawing: YES ];
475
484
476
485
[self .signView addSubview: self .canvas];
477
486
[self .signView bringSubviewToFront: self .canvas];
0 commit comments