// // CPDFViewController.m // PDFViewer // // Created by kdan on 2022/11/15. // #import #import "CPDFViewController.h" @interface CPDFViewController () @end @implementation CPDFViewController - (instancetype)initWithPath:(NSString *)inPath { if (self = [super init]) { _path = inPath; } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSURL *url = [NSURL fileURLWithPath:_path]; CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url]; CPDFView *pdfView = [[CPDFView alloc] initWithFrame:self.view.bounds]; pdfView.document = document; pdfView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view addSubview:pdfView]; } @end