CPDFViewController.m 867 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // CPDFViewController.m
  3. // PDFViewer
  4. //
  5. // Created by kdan on 2022/11/15.
  6. //
  7. #import <ComPDFKit/ComPDFKit.h>
  8. #import <ComPDFKit/CPDFWatermark.h>
  9. #import "CPDFViewController.h"
  10. @interface CPDFViewController ()
  11. @end
  12. @implementation CPDFViewController
  13. - (instancetype)initWithPath:(NSString *)inPath {
  14. if (self = [super init]) {
  15. _path = inPath;
  16. }
  17. return self;
  18. }
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. // Do any additional setup after loading the view.
  22. NSURL *url = [NSURL fileURLWithPath:_path];
  23. CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];
  24. CPDFView *pdfView = [[CPDFView alloc] initWithFrame:self.view.bounds];
  25. pdfView.document = document;
  26. pdfView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  27. [self.view addSubview:pdfView];
  28. }
  29. @end