Browse Source

PDFview(ios) - sdk演示demo集合前的代码规范

yangliuhua 2 years ago
parent
commit
5471e49ae1
81 changed files with 1528 additions and 1516 deletions
  1. 202 188
      PDFViewer.xcodeproj/project.pbxproj
  2. 0 1
      PDFViewer/AppDelegate.m
  3. 19 0
      PDFViewer/Controller/Background/Watermark/PDFWatermarkControllerHeader.h
  4. 19 0
      PDFViewer/Controller/Background/Watermark/PDFWatermarkViewController.h
  5. 82 0
      PDFViewer/Controller/Background/Watermark/PDFWatermarkViewController.m
  6. 0 36
      PDFViewer/Controller/CPDFAddWaterMarkViewController.h
  7. 0 33
      PDFViewer/Controller/CPDFImageViewController.h
  8. 0 32
      PDFViewer/Controller/CPDFTextViewController.h
  9. 0 48
      PDFViewer/Controller/HeaderFooter/CPDFAddViewController.h
  10. 0 19
      PDFViewer/Controller/HeaderFooter/CPDFBatesAddViewController.h
  11. 0 21
      PDFViewer/Controller/HeaderFooter/CPDFHeaderFooterAddController.h
  12. 48 0
      PDFViewer/Controller/HeaderFooter/PDFAddViewController.h
  13. 54 51
      PDFViewer/Controller/HeaderFooter/CPDFAddViewController.m
  14. 9 9
      PDFViewer/Controller/HeaderFooter/CPDFAddViewControllerHeader.h
  15. 19 0
      PDFViewer/Controller/HeaderFooter/PDFBatesAddViewController.h
  16. 22 20
      PDFViewer/Controller/HeaderFooter/CPDFBatesAddViewController.m
  17. 21 0
      PDFViewer/Controller/HeaderFooter/PDFHeaderFooterAddController.h
  18. 22 21
      PDFViewer/Controller/HeaderFooter/CPDFHeaderFooterAddController.m
  19. 34 0
      PDFViewer/Controller/PDFAddWaterMarkViewController.h
  20. 114 160
      PDFViewer/Controller/CPDFAddWaterMarkViewController.m
  21. 4 5
      PDFViewer/Controller/CPDFBackgroundSettingViewController.h
  22. 104 137
      PDFViewer/Controller/CPDFBackgroundSettingViewController.m
  23. 24 0
      PDFViewer/Controller/PDFImageViewController.h
  24. 116 165
      PDFViewer/Controller/CPDFImageViewController.m
  25. 3 3
      PDFViewer/Controller/CPDFListController.h
  26. 16 10
      PDFViewer/Controller/CPDFListController.m
  27. 22 0
      PDFViewer/Controller/PDFTextViewController.h
  28. 136 175
      PDFViewer/Controller/CPDFTextViewController.m
  29. 2 2
      PDFViewer/Controller/CPDFViewController.h
  30. 88 94
      PDFViewer/Controller/CPDFViewController.m
  31. 1 1
      PDFViewer/Model/CPDFBackgroundModel.h
  32. 2 2
      PDFViewer/Model/CPDFBackgroundModel.m
  33. 1 1
      PDFViewer/Model/CPDFDataModel.h
  34. 2 2
      PDFViewer/Model/CPDFDataModel.m
  35. 1 1
      PDFViewer/Model/CPDFHeaderFooterModel.h
  36. 2 2
      PDFViewer/Model/CPDFHeaderFooterModel.m
  37. 1 1
      PDFViewer/Model/CPDFModel.h
  38. 2 2
      PDFViewer/Model/CPDFModel.m
  39. 4 4
      PDFViewer/SceneDelegate.m
  40. 0 43
      PDFViewer/View/CPDFBackgroundPreview.m
  41. 0 27
      PDFViewer/View/CPDFClipView.h
  42. 0 59
      PDFViewer/View/CPDFImagePreview.m
  43. 0 49
      PDFViewer/View/HeaderFooterView/CPDFHeadView.m
  44. 1 1
      PDFViewer/View/HeaderFooterView/CPDFAddView.h
  45. 2 2
      PDFViewer/View/HeaderFooterView/CPDFAddView.m
  46. 2 2
      PDFViewer/View/HeaderFooterView/CPDFBatesAddView.h
  47. 29 2
      PDFViewer/View/HeaderFooterView/CPDFBatesAddView.m
  48. 2 4
      PDFViewer/View/HeaderFooterView/CPDFHeadView.h
  49. 42 0
      PDFViewer/View/HeaderFooterView/PDFHeadView.m
  50. 2 4
      PDFViewer/View/HeaderFooterView/CPDFHeaderFooterAddView.h
  51. 27 5
      PDFViewer/View/HeaderFooterView/CPDFHeaderFooterAddView.m
  52. 1 1
      PDFViewer/View/HeaderFooterView/CPDFHeaderFooterTextTableView.h
  53. 2 2
      PDFViewer/View/HeaderFooterView/CPDFHeaderFooterTextTableView.m
  54. 1 1
      PDFViewer/View/HeaderFooterView/CPDFSettingView.h
  55. 2 2
      PDFViewer/View/HeaderFooterView/CPDFSettingView.m
  56. 2 3
      PDFViewer/View/CPDFBackgroundPreview.h
  57. 40 0
      PDFViewer/View/PDFBackgroundPreview.m
  58. 1 1
      PDFViewer/View/CPDFBackgroundSettingView.h
  59. 2 2
      PDFViewer/View/CPDFBackgroundSettingView.m
  60. 1 1
      PDFViewer/View/CPDFBackgroundView.h
  61. 3 3
      PDFViewer/View/CPDFBackgroundView.m
  62. 18 0
      PDFViewer/View/PDFClipView.h
  63. 5 3
      PDFViewer/View/CPDFClipView.m
  64. 3 3
      PDFViewer/View/CPDFDrawBackgroundView.h
  65. 2 2
      PDFViewer/View/CPDFDrawBackgroundView.m
  66. 1 1
      PDFViewer/View/CPDFDrawImageView.h
  67. 2 2
      PDFViewer/View/CPDFDrawImageView.m
  68. 3 3
      PDFViewer/View/CPDFDrawView.h
  69. 3 3
      PDFViewer/View/CPDFDrawView.m
  70. 2 3
      PDFViewer/View/CPDFImagePreview.h
  71. 56 0
      PDFViewer/View/PDFImagePreview.m
  72. 1 5
      PDFViewer/View/CPDFImageView.h
  73. 2 2
      PDFViewer/View/CPDFImageView.m
  74. 20 0
      PDFViewer/View/PDFPreView.h
  75. 31 0
      PDFViewer/View/PDFPreView.m
  76. 2 3
      PDFViewer/View/CPDFTextPreview.h
  77. 13 15
      PDFViewer/View/CPDFTextPreview.m
  78. 1 6
      PDFViewer/View/CPDFTextView.h
  79. 2 2
      PDFViewer/View/CPDFTextView.m
  80. 1 1
      PDFViewer/View/CPDFEditView.h
  81. 2 2
      PDFViewer/View/CPDFEditView.m

+ 202 - 188
PDFViewer.xcodeproj/project.pbxproj

@@ -7,35 +7,37 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		C92BA1942963F806009954EF /* CPDFDrawBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA1932963F806009954EF /* CPDFDrawBackgroundView.m */; };
-		C92BA1972963F84B009954EF /* CPDFDrawImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA1962963F84B009954EF /* CPDFDrawImageView.m */; };
-		C92BA19A29651CA3009954EF /* CPDFBackgroundModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA19929651CA3009954EF /* CPDFBackgroundModel.m */; };
-		C95FE7472966F37F0038BBF3 /* CPDFHeaderFooterModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7462966F37F0038BBF3 /* CPDFHeaderFooterModel.m */; };
+		C92BA1942963F806009954EF /* PDFDrawBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA1932963F806009954EF /* PDFDrawBackgroundView.m */; };
+		C92BA1972963F84B009954EF /* PDFDrawImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA1962963F84B009954EF /* PDFDrawImageView.m */; };
+		C92BA19A29651CA3009954EF /* PDFBackgroundModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C92BA19929651CA3009954EF /* PDFBackgroundModel.m */; };
+		C95FE7472966F37F0038BBF3 /* PDFHeaderFooterModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7462966F37F0038BBF3 /* PDFHeaderFooterModel.m */; };
 		C95FE74D2966F3F40038BBF3 /* btn_frontpage.png in Resources */ = {isa = PBXBuildFile; fileRef = C95FE7492966F3F40038BBF3 /* btn_frontpage.png */; };
 		C95FE74E2966F3F40038BBF3 /* pageedit_delete.png in Resources */ = {isa = PBXBuildFile; fileRef = C95FE74A2966F3F40038BBF3 /* pageedit_delete.png */; };
 		C95FE74F2966F3F40038BBF3 /* text_color_bar.png in Resources */ = {isa = PBXBuildFile; fileRef = C95FE74B2966F3F40038BBF3 /* text_color_bar.png */; };
 		C95FE7502966F3F40038BBF3 /* add_newpage01.png in Resources */ = {isa = PBXBuildFile; fileRef = C95FE74C2966F3F40038BBF3 /* add_newpage01.png */; };
-		C95FE7652966F5E30038BBF3 /* CPDFHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7642966F5E30038BBF3 /* CPDFHeadView.m */; };
-		C95FE7682966F6000038BBF3 /* CPDFHeaderFooterAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7672966F6000038BBF3 /* CPDFHeaderFooterAddView.m */; };
-		C95FE76B2966F60D0038BBF3 /* CPDFBatesAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE76A2966F60D0038BBF3 /* CPDFBatesAddView.m */; };
-		C95FE76E2966F61A0038BBF3 /* CPDFHeaderFooterTextTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE76D2966F61A0038BBF3 /* CPDFHeaderFooterTextTableView.m */; };
-		C95FE7712966F62E0038BBF3 /* CPDFAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7702966F62E0038BBF3 /* CPDFAddView.m */; };
-		C95FE7742966F63C0038BBF3 /* CPDFSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7732966F63C0038BBF3 /* CPDFSettingView.m */; };
-		C95FE77A2966F7870038BBF3 /* CPDFHeaderFooterAddController.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7792966F7870038BBF3 /* CPDFHeaderFooterAddController.m */; };
-		C95FE77D2966F7970038BBF3 /* CPDFBatesAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE77C2966F7970038BBF3 /* CPDFBatesAddViewController.m */; };
-		C96150D2295400B00020F445 /* CPDFDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = C96150D1295400B00020F445 /* CPDFDrawView.m */; };
-		C96150D529554F660020F445 /* CPDFClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = C96150D429554F660020F445 /* CPDFClipView.m */; };
-		C9638496294ACC240055CCCA /* CPDFAddWaterMarkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9638495294ACC240055CCCA /* CPDFAddWaterMarkViewController.m */; };
+		C95FE7652966F5E30038BBF3 /* PDFHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7642966F5E30038BBF3 /* PDFHeadView.m */; };
+		C95FE7682966F6000038BBF3 /* PDFHeaderFooterAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7672966F6000038BBF3 /* PDFHeaderFooterAddView.m */; };
+		C95FE76B2966F60D0038BBF3 /* PDFBatesAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE76A2966F60D0038BBF3 /* PDFBatesAddView.m */; };
+		C95FE76E2966F61A0038BBF3 /* PDFHeaderFooterTextTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE76D2966F61A0038BBF3 /* PDFHeaderFooterTextTableView.m */; };
+		C95FE7712966F62E0038BBF3 /* PDFAddView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7702966F62E0038BBF3 /* PDFAddView.m */; };
+		C95FE7742966F63C0038BBF3 /* PDFSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7732966F63C0038BBF3 /* PDFSettingView.m */; };
+		C95FE77A2966F7870038BBF3 /* PDFHeaderFooterAddController.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE7792966F7870038BBF3 /* PDFHeaderFooterAddController.m */; };
+		C95FE77D2966F7970038BBF3 /* PDFBatesAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C95FE77C2966F7970038BBF3 /* PDFBatesAddViewController.m */; };
+		C96150D2295400B00020F445 /* PDFDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = C96150D1295400B00020F445 /* PDFDrawView.m */; };
+		C96150D529554F660020F445 /* PDFClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = C96150D429554F660020F445 /* PDFClipView.m */; };
+		C9638496294ACC240055CCCA /* PDFAddWaterMarkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9638495294ACC240055CCCA /* PDFAddWaterMarkViewController.m */; };
 		C96D13932924793800CC92C7 /* btn_more.png in Resources */ = {isa = PBXBuildFile; fileRef = C96D13922924793800CC92C7 /* btn_more.png */; };
-		C97A78732967AC3D0012BA91 /* CPDFAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C97A78722967AC3D0012BA91 /* CPDFAddViewController.m */; };
-		C97E91682959B96C007F6943 /* CPDFEditView.m in Sources */ = {isa = PBXBuildFile; fileRef = C97E91672959B96C007F6943 /* CPDFEditView.m */; };
-		C986D3F52962857900EBD4DF /* CPDFBackgroundSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3F42962857900EBD4DF /* CPDFBackgroundSettingViewController.m */; };
-		C986D3F8296288C400EBD4DF /* CPDFBackgroundPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3F7296288C400EBD4DF /* CPDFBackgroundPreview.m */; };
-		C986D3FB296288F700EBD4DF /* CPDFBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3FA296288F700EBD4DF /* CPDFBackgroundView.m */; };
-		C986D3FE2962A70400EBD4DF /* CPDFBackgroundSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3FD2962A70400EBD4DF /* CPDFBackgroundSettingView.m */; };
+		C97A78732967AC3D0012BA91 /* PDFAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C97A78722967AC3D0012BA91 /* PDFAddViewController.m */; };
+		C97E91682959B96C007F6943 /* PDFEditView.m in Sources */ = {isa = PBXBuildFile; fileRef = C97E91672959B96C007F6943 /* PDFEditView.m */; };
+		C986D3F52962857900EBD4DF /* PDFBackgroundSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3F42962857900EBD4DF /* PDFBackgroundSettingViewController.m */; };
+		C986D3F8296288C400EBD4DF /* PDFBackgroundPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3F7296288C400EBD4DF /* PDFBackgroundPreview.m */; };
+		C986D3FB296288F700EBD4DF /* PDFBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3FA296288F700EBD4DF /* PDFBackgroundView.m */; };
+		C986D3FE2962A70400EBD4DF /* PDFBackgroundSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = C986D3FD2962A70400EBD4DF /* PDFBackgroundSettingView.m */; };
 		C9ECD0E9296BDAEF006C459B /* ComPDFKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9ECD0E7296BDAD1006C459B /* ComPDFKit.xcframework */; };
 		C9ECD0EA296BDAEF006C459B /* ComPDFKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C9ECD0E7296BDAD1006C459B /* ComPDFKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		C9ECD105296CFE45006C459B /* Sample in Resources */ = {isa = PBXBuildFile; fileRef = C9ECD104296CFE45006C459B /* Sample */; };
+		C9ECD1C1296FDB77006C459B /* PDFPreView.m in Sources */ = {isa = PBXBuildFile; fileRef = C9ECD1C0296FDB77006C459B /* PDFPreView.m */; };
+		C9ECD1C42970023B006C459B /* PDFWatermarkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9ECD1C32970023B006C459B /* PDFWatermarkViewController.m */; };
 		EC62978E29220F8300D339EE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EC62978D29220F8300D339EE /* AppDelegate.m */; };
 		EC62979129220F8300D339EE /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EC62979029220F8300D339EE /* SceneDelegate.m */; };
 		EC62979429220F8300D339EE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC62979329220F8300D339EE /* ViewController.m */; };
@@ -43,13 +45,13 @@
 		EC62979929220F8400D339EE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EC62979829220F8400D339EE /* Assets.xcassets */; };
 		EC62979C29220F8400D339EE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EC62979A29220F8400D339EE /* LaunchScreen.storyboard */; };
 		EC62979F29220F8400D339EE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EC62979E29220F8400D339EE /* main.m */; };
-		EC6297B8292239A700D339EE /* CPDFModel.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297B7292239A700D339EE /* CPDFModel.m */; };
-		EC6297BD292239C200D339EE /* CPDFListController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297BC292239C200D339EE /* CPDFListController.m */; };
-		ECC8831D2923352B00F6392E /* CPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECC8831C2923352B00F6392E /* CPDFViewController.m */; };
-		ECD0ABF02928ED9A0091B6EB /* CPDFTextPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */; };
-		ECD0ABF32928ED9A0091B6EB /* CPDFImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE82928ED990091B6EB /* CPDFImageView.m */; };
-		ECD0ABF42928ED9A0091B6EB /* CPDFTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */; };
-		ECD0ABF52928ED9A0091B6EB /* CPDFImagePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */; };
+		EC6297B8292239A700D339EE /* PDFModel.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297B7292239A700D339EE /* PDFModel.m */; };
+		EC6297BD292239C200D339EE /* PDFListController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297BC292239C200D339EE /* PDFListController.m */; };
+		ECC8831D2923352B00F6392E /* PDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECC8831C2923352B00F6392E /* PDFViewController.m */; };
+		ECD0ABF02928ED9A0091B6EB /* PDFTextPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE52928ED990091B6EB /* PDFTextPreview.m */; };
+		ECD0ABF32928ED9A0091B6EB /* PDFImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE82928ED990091B6EB /* PDFImageView.m */; };
+		ECD0ABF42928ED9A0091B6EB /* PDFTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEA2928ED990091B6EB /* PDFTextView.m */; };
+		ECD0ABF52928ED9A0091B6EB /* PDFImagePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEC2928ED9A0091B6EB /* PDFImagePreview.m */; };
 		ECD0AC132928EECB0091B6EB /* MASConstraintMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFB2928EECA0091B6EB /* MASConstraintMaker.m */; };
 		ECD0AC142928EECB0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFE2928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m */; };
 		ECD0AC152928EECB0091B6EB /* MASLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFF2928EECA0091B6EB /* MASLayoutConstraint.m */; };
@@ -61,9 +63,9 @@
 		ECD0AC1C2928EECB0091B6EB /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC0D2928EECA0091B6EB /* View+MASAdditions.m */; };
 		ECD0AC1D2928EECB0091B6EB /* MASViewAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC112928EECB0091B6EB /* MASViewAttribute.m */; };
 		ECD0AC202928EF260091B6EB /* btn_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = ECD0AC1F2928EF260091B6EB /* btn_selected.png */; };
-		ECD0AC232928F2A70091B6EB /* CPDFTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */; };
-		ECD0AC262928F2E50091B6EB /* CPDFImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */; };
-		ECD0AC32292B56C90091B6EB /* CPDFDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */; };
+		ECD0AC232928F2A70091B6EB /* PDFTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC222928F2A70091B6EB /* PDFTextViewController.m */; };
+		ECD0AC262928F2E50091B6EB /* PDFImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC252928F2E50091B6EB /* PDFImageViewController.m */; };
+		ECD0AC32292B56C90091B6EB /* PDFDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC31292B56C90091B6EB /* PDFDataModel.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -81,56 +83,61 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		C92BA1922963F806009954EF /* CPDFDrawBackgroundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFDrawBackgroundView.h; path = ../CPDFDrawBackgroundView.h; sourceTree = "<group>"; };
-		C92BA1932963F806009954EF /* CPDFDrawBackgroundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFDrawBackgroundView.m; path = ../CPDFDrawBackgroundView.m; sourceTree = "<group>"; };
-		C92BA1952963F84B009954EF /* CPDFDrawImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFDrawImageView.h; path = ../CPDFDrawImageView.h; sourceTree = "<group>"; };
-		C92BA1962963F84B009954EF /* CPDFDrawImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFDrawImageView.m; path = ../CPDFDrawImageView.m; sourceTree = "<group>"; };
-		C92BA19829651CA3009954EF /* CPDFBackgroundModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFBackgroundModel.h; sourceTree = "<group>"; };
-		C92BA19929651CA3009954EF /* CPDFBackgroundModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFBackgroundModel.m; sourceTree = "<group>"; };
-		C95FE7452966F3700038BBF3 /* CPDFHeaderFooterModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFHeaderFooterModel.h; sourceTree = "<group>"; };
-		C95FE7462966F37F0038BBF3 /* CPDFHeaderFooterModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFHeaderFooterModel.m; sourceTree = "<group>"; };
+		C92BA1922963F806009954EF /* PDFDrawBackgroundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFDrawBackgroundView.h; path = ../PDFDrawBackgroundView.h; sourceTree = "<group>"; };
+		C92BA1932963F806009954EF /* PDFDrawBackgroundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFDrawBackgroundView.m; path = ../PDFDrawBackgroundView.m; sourceTree = "<group>"; };
+		C92BA1952963F84B009954EF /* PDFDrawImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFDrawImageView.h; path = ../PDFDrawImageView.h; sourceTree = "<group>"; };
+		C92BA1962963F84B009954EF /* PDFDrawImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFDrawImageView.m; path = ../PDFDrawImageView.m; sourceTree = "<group>"; };
+		C92BA19829651CA3009954EF /* PDFBackgroundModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFBackgroundModel.h; sourceTree = "<group>"; };
+		C92BA19929651CA3009954EF /* PDFBackgroundModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFBackgroundModel.m; sourceTree = "<group>"; };
+		C95FE7452966F3700038BBF3 /* PDFHeaderFooterModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFHeaderFooterModel.h; sourceTree = "<group>"; };
+		C95FE7462966F37F0038BBF3 /* PDFHeaderFooterModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFHeaderFooterModel.m; sourceTree = "<group>"; };
 		C95FE7492966F3F40038BBF3 /* btn_frontpage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = btn_frontpage.png; sourceTree = "<group>"; };
 		C95FE74A2966F3F40038BBF3 /* pageedit_delete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pageedit_delete.png; sourceTree = "<group>"; };
 		C95FE74B2966F3F40038BBF3 /* text_color_bar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text_color_bar.png; sourceTree = "<group>"; };
 		C95FE74C2966F3F40038BBF3 /* add_newpage01.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_newpage01.png; sourceTree = "<group>"; };
-		C95FE7632966F4ED0038BBF3 /* CPDFHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFHeadView.h; sourceTree = "<group>"; };
-		C95FE7642966F5E30038BBF3 /* CPDFHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFHeadView.m; sourceTree = "<group>"; };
-		C95FE7662966F5FA0038BBF3 /* CPDFHeaderFooterAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFHeaderFooterAddView.h; sourceTree = "<group>"; };
-		C95FE7672966F6000038BBF3 /* CPDFHeaderFooterAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFHeaderFooterAddView.m; sourceTree = "<group>"; };
-		C95FE7692966F6070038BBF3 /* CPDFBatesAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFBatesAddView.h; sourceTree = "<group>"; };
-		C95FE76A2966F60D0038BBF3 /* CPDFBatesAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFBatesAddView.m; sourceTree = "<group>"; };
-		C95FE76C2966F6140038BBF3 /* CPDFHeaderFooterTextTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFHeaderFooterTextTableView.h; sourceTree = "<group>"; };
-		C95FE76D2966F61A0038BBF3 /* CPDFHeaderFooterTextTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFHeaderFooterTextTableView.m; sourceTree = "<group>"; };
-		C95FE76F2966F6270038BBF3 /* CPDFAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFAddView.h; sourceTree = "<group>"; };
-		C95FE7702966F62E0038BBF3 /* CPDFAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFAddView.m; sourceTree = "<group>"; };
-		C95FE7722966F6350038BBF3 /* CPDFSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFSettingView.h; sourceTree = "<group>"; };
-		C95FE7732966F63C0038BBF3 /* CPDFSettingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFSettingView.m; sourceTree = "<group>"; };
-		C95FE7782966F7810038BBF3 /* CPDFHeaderFooterAddController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFHeaderFooterAddController.h; sourceTree = "<group>"; };
-		C95FE7792966F7870038BBF3 /* CPDFHeaderFooterAddController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFHeaderFooterAddController.m; sourceTree = "<group>"; };
-		C95FE77B2966F78E0038BBF3 /* CPDFBatesAddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFBatesAddViewController.h; sourceTree = "<group>"; };
-		C95FE77C2966F7970038BBF3 /* CPDFBatesAddViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFBatesAddViewController.m; sourceTree = "<group>"; };
-		C95FE7812966F7AF0038BBF3 /* CPDFAddViewControllerHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFAddViewControllerHeader.h; sourceTree = "<group>"; };
-		C96150D0295400B00020F445 /* CPDFDrawView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFDrawView.h; path = ../CPDFDrawView.h; sourceTree = "<group>"; };
-		C96150D1295400B00020F445 /* CPDFDrawView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFDrawView.m; path = ../CPDFDrawView.m; sourceTree = "<group>"; };
-		C96150D329554F660020F445 /* CPDFClipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFClipView.h; path = ../CPDFClipView.h; sourceTree = "<group>"; };
-		C96150D429554F660020F445 /* CPDFClipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFClipView.m; path = ../CPDFClipView.m; sourceTree = "<group>"; };
-		C9638494294ACC240055CCCA /* CPDFAddWaterMarkViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFAddWaterMarkViewController.h; path = ../../CPDFAddWaterMarkViewController.h; sourceTree = "<group>"; };
-		C9638495294ACC240055CCCA /* CPDFAddWaterMarkViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFAddWaterMarkViewController.m; path = ../../CPDFAddWaterMarkViewController.m; sourceTree = "<group>"; };
+		C95FE7632966F4ED0038BBF3 /* PDFHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFHeadView.h; sourceTree = "<group>"; };
+		C95FE7642966F5E30038BBF3 /* PDFHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFHeadView.m; sourceTree = "<group>"; };
+		C95FE7662966F5FA0038BBF3 /* PDFHeaderFooterAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFHeaderFooterAddView.h; sourceTree = "<group>"; };
+		C95FE7672966F6000038BBF3 /* PDFHeaderFooterAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFHeaderFooterAddView.m; sourceTree = "<group>"; };
+		C95FE7692966F6070038BBF3 /* PDFBatesAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFBatesAddView.h; sourceTree = "<group>"; };
+		C95FE76A2966F60D0038BBF3 /* PDFBatesAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFBatesAddView.m; sourceTree = "<group>"; };
+		C95FE76C2966F6140038BBF3 /* PDFHeaderFooterTextTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFHeaderFooterTextTableView.h; sourceTree = "<group>"; };
+		C95FE76D2966F61A0038BBF3 /* PDFHeaderFooterTextTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFHeaderFooterTextTableView.m; sourceTree = "<group>"; };
+		C95FE76F2966F6270038BBF3 /* PDFAddView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFAddView.h; sourceTree = "<group>"; };
+		C95FE7702966F62E0038BBF3 /* PDFAddView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFAddView.m; sourceTree = "<group>"; };
+		C95FE7722966F6350038BBF3 /* PDFSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFSettingView.h; sourceTree = "<group>"; };
+		C95FE7732966F63C0038BBF3 /* PDFSettingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFSettingView.m; sourceTree = "<group>"; };
+		C95FE7782966F7810038BBF3 /* PDFHeaderFooterAddController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFHeaderFooterAddController.h; sourceTree = "<group>"; };
+		C95FE7792966F7870038BBF3 /* PDFHeaderFooterAddController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFHeaderFooterAddController.m; sourceTree = "<group>"; };
+		C95FE77B2966F78E0038BBF3 /* PDFBatesAddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFBatesAddViewController.h; sourceTree = "<group>"; };
+		C95FE77C2966F7970038BBF3 /* PDFBatesAddViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFBatesAddViewController.m; sourceTree = "<group>"; };
+		C95FE7812966F7AF0038BBF3 /* PDFAddViewControllerHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFAddViewControllerHeader.h; sourceTree = "<group>"; };
+		C96150D0295400B00020F445 /* PDFDrawView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFDrawView.h; path = ../PDFDrawView.h; sourceTree = "<group>"; };
+		C96150D1295400B00020F445 /* PDFDrawView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFDrawView.m; path = ../PDFDrawView.m; sourceTree = "<group>"; };
+		C96150D329554F660020F445 /* PDFClipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFClipView.h; path = ../PDFClipView.h; sourceTree = "<group>"; };
+		C96150D429554F660020F445 /* PDFClipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFClipView.m; path = ../PDFClipView.m; sourceTree = "<group>"; };
+		C9638494294ACC240055CCCA /* PDFAddWaterMarkViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFAddWaterMarkViewController.h; path = ../../PDFAddWaterMarkViewController.h; sourceTree = "<group>"; };
+		C9638495294ACC240055CCCA /* PDFAddWaterMarkViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFAddWaterMarkViewController.m; path = ../../PDFAddWaterMarkViewController.m; sourceTree = "<group>"; };
 		C96D13922924793800CC92C7 /* btn_more.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = btn_more.png; sourceTree = "<group>"; };
-		C97A78702967AC210012BA91 /* CPDFAddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFAddViewController.h; sourceTree = "<group>"; };
-		C97A78722967AC3D0012BA91 /* CPDFAddViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFAddViewController.m; sourceTree = "<group>"; };
-		C97E91662959B96C007F6943 /* CPDFEditView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFEditView.h; sourceTree = "<group>"; };
-		C97E91672959B96C007F6943 /* CPDFEditView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFEditView.m; sourceTree = "<group>"; };
-		C986D3F32962857900EBD4DF /* CPDFBackgroundSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFBackgroundSettingViewController.h; path = ../CPDFBackgroundSettingViewController.h; sourceTree = "<group>"; };
-		C986D3F42962857900EBD4DF /* CPDFBackgroundSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFBackgroundSettingViewController.m; path = ../CPDFBackgroundSettingViewController.m; sourceTree = "<group>"; };
-		C986D3F6296288C400EBD4DF /* CPDFBackgroundPreview.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFBackgroundPreview.h; path = ../CPDFBackgroundPreview.h; sourceTree = "<group>"; };
-		C986D3F7296288C400EBD4DF /* CPDFBackgroundPreview.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFBackgroundPreview.m; path = ../CPDFBackgroundPreview.m; sourceTree = "<group>"; };
-		C986D3F9296288F700EBD4DF /* CPDFBackgroundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFBackgroundView.h; path = ../CPDFBackgroundView.h; sourceTree = "<group>"; };
-		C986D3FA296288F700EBD4DF /* CPDFBackgroundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFBackgroundView.m; path = ../CPDFBackgroundView.m; sourceTree = "<group>"; };
-		C986D3FC2962A70400EBD4DF /* CPDFBackgroundSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFBackgroundSettingView.h; path = ../CPDFBackgroundSettingView.h; sourceTree = "<group>"; };
-		C986D3FD2962A70400EBD4DF /* CPDFBackgroundSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFBackgroundSettingView.m; path = ../CPDFBackgroundSettingView.m; sourceTree = "<group>"; };
+		C97A78702967AC210012BA91 /* PDFAddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFAddViewController.h; sourceTree = "<group>"; };
+		C97A78722967AC3D0012BA91 /* PDFAddViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFAddViewController.m; sourceTree = "<group>"; };
+		C97E91662959B96C007F6943 /* PDFEditView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFEditView.h; sourceTree = "<group>"; };
+		C97E91672959B96C007F6943 /* PDFEditView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFEditView.m; sourceTree = "<group>"; };
+		C986D3F32962857900EBD4DF /* PDFBackgroundSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFBackgroundSettingViewController.h; path = ../PDFBackgroundSettingViewController.h; sourceTree = "<group>"; };
+		C986D3F42962857900EBD4DF /* PDFBackgroundSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFBackgroundSettingViewController.m; path = ../PDFBackgroundSettingViewController.m; sourceTree = "<group>"; };
+		C986D3F6296288C400EBD4DF /* PDFBackgroundPreview.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFBackgroundPreview.h; path = ../PDFBackgroundPreview.h; sourceTree = "<group>"; };
+		C986D3F7296288C400EBD4DF /* PDFBackgroundPreview.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFBackgroundPreview.m; path = ../PDFBackgroundPreview.m; sourceTree = "<group>"; };
+		C986D3F9296288F700EBD4DF /* PDFBackgroundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFBackgroundView.h; path = ../PDFBackgroundView.h; sourceTree = "<group>"; };
+		C986D3FA296288F700EBD4DF /* PDFBackgroundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFBackgroundView.m; path = ../PDFBackgroundView.m; sourceTree = "<group>"; };
+		C986D3FC2962A70400EBD4DF /* PDFBackgroundSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFBackgroundSettingView.h; path = ../PDFBackgroundSettingView.h; sourceTree = "<group>"; };
+		C986D3FD2962A70400EBD4DF /* PDFBackgroundSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFBackgroundSettingView.m; path = ../PDFBackgroundSettingView.m; sourceTree = "<group>"; };
 		C9ECD0E7296BDAD1006C459B /* ComPDFKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = ComPDFKit.xcframework; sourceTree = "<group>"; };
 		C9ECD104296CFE45006C459B /* Sample */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Sample; sourceTree = "<group>"; };
+		C9ECD1BF296FDB77006C459B /* PDFPreView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFPreView.h; sourceTree = "<group>"; };
+		C9ECD1C0296FDB77006C459B /* PDFPreView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFPreView.m; sourceTree = "<group>"; };
+		C9ECD1C22970023B006C459B /* PDFWatermarkViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFWatermarkViewController.h; sourceTree = "<group>"; };
+		C9ECD1C32970023B006C459B /* PDFWatermarkViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFWatermarkViewController.m; sourceTree = "<group>"; };
+		C9ECD1C5297003AF006C459B /* PDFWatermarkControllerHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFWatermarkControllerHeader.h; sourceTree = "<group>"; };
 		EC62978929220F8300D339EE /* PDFViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PDFViewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		EC62978C29220F8300D339EE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
 		EC62978D29220F8300D339EE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -143,20 +150,20 @@
 		EC62979B29220F8400D339EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		EC62979D29220F8400D339EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		EC62979E29220F8400D339EE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
-		EC6297B6292239A700D339EE /* CPDFModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFModel.h; sourceTree = "<group>"; };
-		EC6297B7292239A700D339EE /* CPDFModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFModel.m; sourceTree = "<group>"; };
-		EC6297BB292239C200D339EE /* CPDFListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFListController.h; sourceTree = "<group>"; };
-		EC6297BC292239C200D339EE /* CPDFListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFListController.m; sourceTree = "<group>"; };
-		ECC8831B2923352B00F6392E /* CPDFViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFViewController.h; sourceTree = "<group>"; };
-		ECC8831C2923352B00F6392E /* CPDFViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFViewController.m; sourceTree = "<group>"; };
-		ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPDFTextPreview.m; path = ../CPDFTextPreview.m; sourceTree = "<group>"; };
-		ECD0ABE82928ED990091B6EB /* CPDFImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPDFImageView.m; path = ../CPDFImageView.m; sourceTree = "<group>"; };
-		ECD0ABE92928ED990091B6EB /* CPDFTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPDFTextView.h; path = ../CPDFTextView.h; sourceTree = "<group>"; };
-		ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPDFTextView.m; path = ../CPDFTextView.m; sourceTree = "<group>"; };
-		ECD0ABEB2928ED9A0091B6EB /* CPDFImagePreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPDFImagePreview.h; path = ../CPDFImagePreview.h; sourceTree = "<group>"; };
-		ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPDFImagePreview.m; path = ../CPDFImagePreview.m; sourceTree = "<group>"; };
-		ECD0ABED2928ED9A0091B6EB /* CPDFImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPDFImageView.h; path = ../CPDFImageView.h; sourceTree = "<group>"; };
-		ECD0ABEF2928ED9A0091B6EB /* CPDFTextPreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPDFTextPreview.h; path = ../CPDFTextPreview.h; sourceTree = "<group>"; };
+		EC6297B6292239A700D339EE /* PDFModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFModel.h; sourceTree = "<group>"; };
+		EC6297B7292239A700D339EE /* PDFModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFModel.m; sourceTree = "<group>"; };
+		EC6297BB292239C200D339EE /* PDFListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFListController.h; sourceTree = "<group>"; };
+		EC6297BC292239C200D339EE /* PDFListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFListController.m; sourceTree = "<group>"; };
+		ECC8831B2923352B00F6392E /* PDFViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFViewController.h; sourceTree = "<group>"; };
+		ECC8831C2923352B00F6392E /* PDFViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFViewController.m; sourceTree = "<group>"; };
+		ECD0ABE52928ED990091B6EB /* PDFTextPreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PDFTextPreview.m; path = ../PDFTextPreview.m; sourceTree = "<group>"; };
+		ECD0ABE82928ED990091B6EB /* PDFImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PDFImageView.m; path = ../PDFImageView.m; sourceTree = "<group>"; };
+		ECD0ABE92928ED990091B6EB /* PDFTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFTextView.h; path = ../PDFTextView.h; sourceTree = "<group>"; };
+		ECD0ABEA2928ED990091B6EB /* PDFTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PDFTextView.m; path = ../PDFTextView.m; sourceTree = "<group>"; };
+		ECD0ABEB2928ED9A0091B6EB /* PDFImagePreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFImagePreview.h; path = ../PDFImagePreview.h; sourceTree = "<group>"; };
+		ECD0ABEC2928ED9A0091B6EB /* PDFImagePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PDFImagePreview.m; path = ../PDFImagePreview.m; sourceTree = "<group>"; };
+		ECD0ABED2928ED9A0091B6EB /* PDFImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFImageView.h; path = ../PDFImageView.h; sourceTree = "<group>"; };
+		ECD0ABEF2928ED9A0091B6EB /* PDFTextPreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFTextPreview.h; path = ../PDFTextPreview.h; sourceTree = "<group>"; };
 		ECD0ABF92928EECA0091B6EB /* NSArray+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MASAdditions.h"; sourceTree = "<group>"; };
 		ECD0ABFA2928EECA0091B6EB /* View+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASAdditions.h"; sourceTree = "<group>"; };
 		ECD0ABFB2928EECA0091B6EB /* MASConstraintMaker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraintMaker.m; sourceTree = "<group>"; };
@@ -183,12 +190,12 @@
 		ECD0AC112928EECB0091B6EB /* MASViewAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewAttribute.m; sourceTree = "<group>"; };
 		ECD0AC122928EECB0091B6EB /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = "<group>"; };
 		ECD0AC1F2928EF260091B6EB /* btn_selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = btn_selected.png; sourceTree = "<group>"; };
-		ECD0AC212928F2A70091B6EB /* CPDFTextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFTextViewController.h; path = ../../CPDFTextViewController.h; sourceTree = "<group>"; };
-		ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFTextViewController.m; path = ../../CPDFTextViewController.m; sourceTree = "<group>"; };
-		ECD0AC242928F2E50091B6EB /* CPDFImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CPDFImageViewController.h; path = ../../CPDFImageViewController.h; sourceTree = "<group>"; };
-		ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CPDFImageViewController.m; path = ../../CPDFImageViewController.m; sourceTree = "<group>"; };
-		ECD0AC30292B56C90091B6EB /* CPDFDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFDataModel.h; sourceTree = "<group>"; };
-		ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFDataModel.m; sourceTree = "<group>"; };
+		ECD0AC212928F2A70091B6EB /* PDFTextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFTextViewController.h; path = ../../PDFTextViewController.h; sourceTree = "<group>"; };
+		ECD0AC222928F2A70091B6EB /* PDFTextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFTextViewController.m; path = ../../PDFTextViewController.m; sourceTree = "<group>"; };
+		ECD0AC242928F2E50091B6EB /* PDFImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFImageViewController.h; path = ../../PDFImageViewController.h; sourceTree = "<group>"; };
+		ECD0AC252928F2E50091B6EB /* PDFImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PDFImageViewController.m; path = ../../PDFImageViewController.m; sourceTree = "<group>"; };
+		ECD0AC30292B56C90091B6EB /* PDFDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PDFDataModel.h; sourceTree = "<group>"; };
+		ECD0AC31292B56C90091B6EB /* PDFDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PDFDataModel.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -218,17 +225,18 @@
 		C95FE7752966F65F0038BBF3 /* HeaderFooterView */ = {
 			isa = PBXGroup;
 			children = (
-				C95FE7632966F4ED0038BBF3 /* CPDFHeadView.h */,
-				C95FE7642966F5E30038BBF3 /* CPDFHeadView.m */,
-				C95FE7662966F5FA0038BBF3 /* CPDFHeaderFooterAddView.h */,
-				C95FE7672966F6000038BBF3 /* CPDFHeaderFooterAddView.m */,
-				C95FE7692966F6070038BBF3 /* CPDFBatesAddView.h */,
-				C95FE76A2966F60D0038BBF3 /* CPDFBatesAddView.m */,
-				C95FE76C2966F6140038BBF3 /* CPDFHeaderFooterTextTableView.h */,
-				C95FE76D2966F61A0038BBF3 /* CPDFHeaderFooterTextTableView.m */,
-				C95FE76F2966F6270038BBF3 /* CPDFAddView.h */,
-				C95FE7702966F62E0038BBF3 /* CPDFAddView.m */,
-				C95FE7732966F63C0038BBF3 /* CPDFSettingView.m */,
+				C95FE7632966F4ED0038BBF3 /* PDFHeadView.h */,
+				C95FE7642966F5E30038BBF3 /* PDFHeadView.m */,
+				C95FE7662966F5FA0038BBF3 /* PDFHeaderFooterAddView.h */,
+				C95FE7672966F6000038BBF3 /* PDFHeaderFooterAddView.m */,
+				C95FE7692966F6070038BBF3 /* PDFBatesAddView.h */,
+				C95FE76A2966F60D0038BBF3 /* PDFBatesAddView.m */,
+				C95FE76C2966F6140038BBF3 /* PDFHeaderFooterTextTableView.h */,
+				C95FE76D2966F61A0038BBF3 /* PDFHeaderFooterTextTableView.m */,
+				C95FE76F2966F6270038BBF3 /* PDFAddView.h */,
+				C95FE7702966F62E0038BBF3 /* PDFAddView.m */,
+				C95FE7722966F6350038BBF3 /* PDFSettingView.h */,
+				C95FE7732966F63C0038BBF3 /* PDFSettingView.m */,
 			);
 			path = HeaderFooterView;
 			sourceTree = "<group>";
@@ -236,21 +244,20 @@
 		C95FE7762966F6AF0038BBF3 /* WatermarkView */ = {
 			isa = PBXGroup;
 			children = (
-				ECD0ABE82928ED990091B6EB /* CPDFImageView.m */,
-				ECD0ABED2928ED9A0091B6EB /* CPDFImageView.h */,
-				ECD0ABEB2928ED9A0091B6EB /* CPDFImagePreview.h */,
-				ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */,
-				C95FE7722966F6350038BBF3 /* CPDFSettingView.h */,
-				ECD0ABEF2928ED9A0091B6EB /* CPDFTextPreview.h */,
-				ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */,
-				ECD0ABE92928ED990091B6EB /* CPDFTextView.h */,
-				ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */,
-				C96150D0295400B00020F445 /* CPDFDrawView.h */,
-				C96150D1295400B00020F445 /* CPDFDrawView.m */,
-				C96150D329554F660020F445 /* CPDFClipView.h */,
-				C96150D429554F660020F445 /* CPDFClipView.m */,
-				C97E91662959B96C007F6943 /* CPDFEditView.h */,
-				C97E91672959B96C007F6943 /* CPDFEditView.m */,
+				ECD0ABE82928ED990091B6EB /* PDFImageView.m */,
+				ECD0ABED2928ED9A0091B6EB /* PDFImageView.h */,
+				ECD0ABEB2928ED9A0091B6EB /* PDFImagePreview.h */,
+				ECD0ABEC2928ED9A0091B6EB /* PDFImagePreview.m */,
+				ECD0ABEF2928ED9A0091B6EB /* PDFTextPreview.h */,
+				ECD0ABE52928ED990091B6EB /* PDFTextPreview.m */,
+				ECD0ABE92928ED990091B6EB /* PDFTextView.h */,
+				ECD0ABEA2928ED990091B6EB /* PDFTextView.m */,
+				C96150D0295400B00020F445 /* PDFDrawView.h */,
+				C96150D1295400B00020F445 /* PDFDrawView.m */,
+				C96150D329554F660020F445 /* PDFClipView.h */,
+				C96150D429554F660020F445 /* PDFClipView.m */,
+				C97E91662959B96C007F6943 /* PDFEditView.h */,
+				C97E91672959B96C007F6943 /* PDFEditView.m */,
 			);
 			path = WatermarkView;
 			sourceTree = "<group>";
@@ -258,16 +265,16 @@
 		C95FE7772966F70B0038BBF3 /* BackgroundView */ = {
 			isa = PBXGroup;
 			children = (
-				C986D3F6296288C400EBD4DF /* CPDFBackgroundPreview.h */,
-				C986D3F7296288C400EBD4DF /* CPDFBackgroundPreview.m */,
-				C986D3F9296288F700EBD4DF /* CPDFBackgroundView.h */,
-				C986D3FA296288F700EBD4DF /* CPDFBackgroundView.m */,
-				C986D3FC2962A70400EBD4DF /* CPDFBackgroundSettingView.h */,
-				C986D3FD2962A70400EBD4DF /* CPDFBackgroundSettingView.m */,
-				C92BA1922963F806009954EF /* CPDFDrawBackgroundView.h */,
-				C92BA1932963F806009954EF /* CPDFDrawBackgroundView.m */,
-				C92BA1952963F84B009954EF /* CPDFDrawImageView.h */,
-				C92BA1962963F84B009954EF /* CPDFDrawImageView.m */,
+				C986D3F6296288C400EBD4DF /* PDFBackgroundPreview.h */,
+				C986D3F7296288C400EBD4DF /* PDFBackgroundPreview.m */,
+				C986D3F9296288F700EBD4DF /* PDFBackgroundView.h */,
+				C986D3FA296288F700EBD4DF /* PDFBackgroundView.m */,
+				C986D3FC2962A70400EBD4DF /* PDFBackgroundSettingView.h */,
+				C986D3FD2962A70400EBD4DF /* PDFBackgroundSettingView.m */,
+				C92BA1922963F806009954EF /* PDFDrawBackgroundView.h */,
+				C92BA1932963F806009954EF /* PDFDrawBackgroundView.m */,
+				C92BA1952963F84B009954EF /* PDFDrawImageView.h */,
+				C92BA1962963F84B009954EF /* PDFDrawImageView.m */,
 			);
 			path = BackgroundView;
 			sourceTree = "<group>";
@@ -283,13 +290,13 @@
 		C97A786F2967AC000012BA91 /* HeaderFooter */ = {
 			isa = PBXGroup;
 			children = (
-				C95FE7782966F7810038BBF3 /* CPDFHeaderFooterAddController.h */,
-				C97A78702967AC210012BA91 /* CPDFAddViewController.h */,
-				C95FE77C2966F7970038BBF3 /* CPDFBatesAddViewController.m */,
-				C97A78722967AC3D0012BA91 /* CPDFAddViewController.m */,
-				C95FE7792966F7870038BBF3 /* CPDFHeaderFooterAddController.m */,
-				C95FE77B2966F78E0038BBF3 /* CPDFBatesAddViewController.h */,
-				C95FE7812966F7AF0038BBF3 /* CPDFAddViewControllerHeader.h */,
+				C95FE7782966F7810038BBF3 /* PDFHeaderFooterAddController.h */,
+				C97A78702967AC210012BA91 /* PDFAddViewController.h */,
+				C95FE77C2966F7970038BBF3 /* PDFBatesAddViewController.m */,
+				C97A78722967AC3D0012BA91 /* PDFAddViewController.m */,
+				C95FE7792966F7870038BBF3 /* PDFHeaderFooterAddController.m */,
+				C95FE77B2966F78E0038BBF3 /* PDFBatesAddViewController.h */,
+				C95FE7812966F7AF0038BBF3 /* PDFAddViewControllerHeader.h */,
 			);
 			path = HeaderFooter;
 			sourceTree = "<group>";
@@ -297,8 +304,8 @@
 		C97A787E2967AEB00012BA91 /* Background */ = {
 			isa = PBXGroup;
 			children = (
-				C986D3F32962857900EBD4DF /* CPDFBackgroundSettingViewController.h */,
-				C986D3F42962857900EBD4DF /* CPDFBackgroundSettingViewController.m */,
+				C986D3F32962857900EBD4DF /* PDFBackgroundSettingViewController.h */,
+				C986D3F42962857900EBD4DF /* PDFBackgroundSettingViewController.m */,
 			);
 			path = Background;
 			sourceTree = "<group>";
@@ -306,12 +313,15 @@
 		C97A78822967AF980012BA91 /* Watermark */ = {
 			isa = PBXGroup;
 			children = (
-				ECD0AC212928F2A70091B6EB /* CPDFTextViewController.h */,
-				ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */,
-				ECD0AC242928F2E50091B6EB /* CPDFImageViewController.h */,
-				ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */,
-				C9638494294ACC240055CCCA /* CPDFAddWaterMarkViewController.h */,
-				C9638495294ACC240055CCCA /* CPDFAddWaterMarkViewController.m */,
+				ECD0AC212928F2A70091B6EB /* PDFTextViewController.h */,
+				ECD0AC222928F2A70091B6EB /* PDFTextViewController.m */,
+				ECD0AC242928F2E50091B6EB /* PDFImageViewController.h */,
+				ECD0AC252928F2E50091B6EB /* PDFImageViewController.m */,
+				C9638494294ACC240055CCCA /* PDFAddWaterMarkViewController.h */,
+				C9638495294ACC240055CCCA /* PDFAddWaterMarkViewController.m */,
+				C9ECD1C22970023B006C459B /* PDFWatermarkViewController.h */,
+				C9ECD1C32970023B006C459B /* PDFWatermarkViewController.m */,
+				C9ECD1C5297003AF006C459B /* PDFWatermarkControllerHeader.h */,
 			);
 			name = Watermark;
 			path = Background/Watermark;
@@ -360,14 +370,14 @@
 		EC6297AD29222D3100D339EE /* Model */ = {
 			isa = PBXGroup;
 			children = (
-				EC6297B6292239A700D339EE /* CPDFModel.h */,
-				EC6297B7292239A700D339EE /* CPDFModel.m */,
-				C95FE7452966F3700038BBF3 /* CPDFHeaderFooterModel.h */,
-				C95FE7462966F37F0038BBF3 /* CPDFHeaderFooterModel.m */,
-				ECD0AC30292B56C90091B6EB /* CPDFDataModel.h */,
-				ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */,
-				C92BA19829651CA3009954EF /* CPDFBackgroundModel.h */,
-				C92BA19929651CA3009954EF /* CPDFBackgroundModel.m */,
+				EC6297B6292239A700D339EE /* PDFModel.h */,
+				EC6297B7292239A700D339EE /* PDFModel.m */,
+				C95FE7452966F3700038BBF3 /* PDFHeaderFooterModel.h */,
+				C95FE7462966F37F0038BBF3 /* PDFHeaderFooterModel.m */,
+				ECD0AC30292B56C90091B6EB /* PDFDataModel.h */,
+				ECD0AC31292B56C90091B6EB /* PDFDataModel.m */,
+				C92BA19829651CA3009954EF /* PDFBackgroundModel.h */,
+				C92BA19929651CA3009954EF /* PDFBackgroundModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -376,10 +386,10 @@
 			isa = PBXGroup;
 			children = (
 				C96D13912924791E00CC92C7 /* Images */,
-				EC6297BB292239C200D339EE /* CPDFListController.h */,
-				EC6297BC292239C200D339EE /* CPDFListController.m */,
-				ECC8831B2923352B00F6392E /* CPDFViewController.h */,
-				ECC8831C2923352B00F6392E /* CPDFViewController.m */,
+				EC6297BB292239C200D339EE /* PDFListController.h */,
+				EC6297BC292239C200D339EE /* PDFListController.m */,
+				ECC8831B2923352B00F6392E /* PDFViewController.h */,
+				ECC8831C2923352B00F6392E /* PDFViewController.m */,
 				C97A78822967AF980012BA91 /* Watermark */,
 				C97A787E2967AEB00012BA91 /* Background */,
 				C97A786F2967AC000012BA91 /* HeaderFooter */,
@@ -394,6 +404,8 @@
 				C95FE7772966F70B0038BBF3 /* BackgroundView */,
 				C95FE7762966F6AF0038BBF3 /* WatermarkView */,
 				C95FE7752966F65F0038BBF3 /* HeaderFooterView */,
+				C9ECD1BF296FDB77006C459B /* PDFPreView.h */,
+				C9ECD1C0296FDB77006C459B /* PDFPreView.m */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -507,51 +519,53 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				ECC8831D2923352B00F6392E /* CPDFViewController.m in Sources */,
-				C95FE7652966F5E30038BBF3 /* CPDFHeadView.m in Sources */,
+				C9ECD1C42970023B006C459B /* PDFWatermarkViewController.m in Sources */,
+				ECC8831D2923352B00F6392E /* PDFViewController.m in Sources */,
+				C95FE7652966F5E30038BBF3 /* PDFHeadView.m in Sources */,
 				EC62979429220F8300D339EE /* ViewController.m in Sources */,
 				ECD0AC172928EECB0091B6EB /* MASConstraint.m in Sources */,
-				C97E91682959B96C007F6943 /* CPDFEditView.m in Sources */,
-				C96150D2295400B00020F445 /* CPDFDrawView.m in Sources */,
-				C95FE77D2966F7970038BBF3 /* CPDFBatesAddViewController.m in Sources */,
-				EC6297B8292239A700D339EE /* CPDFModel.m in Sources */,
-				ECD0AC232928F2A70091B6EB /* CPDFTextViewController.m in Sources */,
-				ECD0AC262928F2E50091B6EB /* CPDFImageViewController.m in Sources */,
-				C95FE7472966F37F0038BBF3 /* CPDFHeaderFooterModel.m in Sources */,
-				ECD0ABF02928ED9A0091B6EB /* CPDFTextPreview.m in Sources */,
-				C97A78732967AC3D0012BA91 /* CPDFAddViewController.m in Sources */,
-				C9638496294ACC240055CCCA /* CPDFAddWaterMarkViewController.m in Sources */,
+				C97E91682959B96C007F6943 /* PDFEditView.m in Sources */,
+				C96150D2295400B00020F445 /* PDFDrawView.m in Sources */,
+				C95FE77D2966F7970038BBF3 /* PDFBatesAddViewController.m in Sources */,
+				EC6297B8292239A700D339EE /* PDFModel.m in Sources */,
+				ECD0AC232928F2A70091B6EB /* PDFTextViewController.m in Sources */,
+				ECD0AC262928F2E50091B6EB /* PDFImageViewController.m in Sources */,
+				C95FE7472966F37F0038BBF3 /* PDFHeaderFooterModel.m in Sources */,
+				ECD0ABF02928ED9A0091B6EB /* PDFTextPreview.m in Sources */,
+				C97A78732967AC3D0012BA91 /* PDFAddViewController.m in Sources */,
+				C9ECD1C1296FDB77006C459B /* PDFPreView.m in Sources */,
+				C9638496294ACC240055CCCA /* PDFAddWaterMarkViewController.m in Sources */,
 				ECD0AC1D2928EECB0091B6EB /* MASViewAttribute.m in Sources */,
-				C95FE76B2966F60D0038BBF3 /* CPDFBatesAddView.m in Sources */,
+				C95FE76B2966F60D0038BBF3 /* PDFBatesAddView.m in Sources */,
 				ECD0AC182928EECB0091B6EB /* MASCompositeConstraint.m in Sources */,
-				C986D3FE2962A70400EBD4DF /* CPDFBackgroundSettingView.m in Sources */,
+				C986D3FE2962A70400EBD4DF /* PDFBackgroundSettingView.m in Sources */,
 				ECD0AC1C2928EECB0091B6EB /* View+MASAdditions.m in Sources */,
-				C95FE7712966F62E0038BBF3 /* CPDFAddView.m in Sources */,
-				C96150D529554F660020F445 /* CPDFClipView.m in Sources */,
+				C95FE7712966F62E0038BBF3 /* PDFAddView.m in Sources */,
+				C96150D529554F660020F445 /* PDFClipView.m in Sources */,
 				ECD0AC152928EECB0091B6EB /* MASLayoutConstraint.m in Sources */,
 				EC62978E29220F8300D339EE /* AppDelegate.m in Sources */,
-				C95FE7742966F63C0038BBF3 /* CPDFSettingView.m in Sources */,
+				C95FE7742966F63C0038BBF3 /* PDFSettingView.m in Sources */,
 				EC62979F29220F8400D339EE /* main.m in Sources */,
-				EC6297BD292239C200D339EE /* CPDFListController.m in Sources */,
-				C92BA1942963F806009954EF /* CPDFDrawBackgroundView.m in Sources */,
-				C986D3F52962857900EBD4DF /* CPDFBackgroundSettingViewController.m in Sources */,
+				EC6297BD292239C200D339EE /* PDFListController.m in Sources */,
+				C92BA1942963F806009954EF /* PDFDrawBackgroundView.m in Sources */,
+				C986D3F52962857900EBD4DF /* PDFBackgroundSettingViewController.m in Sources */,
 				ECD0AC132928EECB0091B6EB /* MASConstraintMaker.m in Sources */,
 				ECD0AC1A2928EECB0091B6EB /* ViewController+MASAdditions.m in Sources */,
-				C95FE76E2966F61A0038BBF3 /* CPDFHeaderFooterTextTableView.m in Sources */,
+				C95FE76E2966F61A0038BBF3 /* PDFHeaderFooterTextTableView.m in Sources */,
 				ECD0AC142928EECB0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m in Sources */,
 				ECD0AC162928EECB0091B6EB /* NSArray+MASAdditions.m in Sources */,
-				C986D3FB296288F700EBD4DF /* CPDFBackgroundView.m in Sources */,
-				C95FE77A2966F7870038BBF3 /* CPDFHeaderFooterAddController.m in Sources */,
-				C92BA19A29651CA3009954EF /* CPDFBackgroundModel.m in Sources */,
+				C986D3FB296288F700EBD4DF /* PDFBackgroundView.m in Sources */,
+				C95FE77A2966F7870038BBF3 /* PDFHeaderFooterAddController.m in Sources */,
+				C92BA19A29651CA3009954EF /* PDFBackgroundModel.m in Sources */,
 				ECD0AC192928EECB0091B6EB /* MASViewConstraint.m in Sources */,
 				EC62979129220F8300D339EE /* SceneDelegate.m in Sources */,
-				C92BA1972963F84B009954EF /* CPDFDrawImageView.m in Sources */,
-				ECD0ABF52928ED9A0091B6EB /* CPDFImagePreview.m in Sources */,
-				ECD0AC32292B56C90091B6EB /* CPDFDataModel.m in Sources */,
-				ECD0ABF42928ED9A0091B6EB /* CPDFTextView.m in Sources */,
-				ECD0ABF32928ED9A0091B6EB /* CPDFImageView.m in Sources */,
-				C95FE7682966F6000038BBF3 /* CPDFHeaderFooterAddView.m in Sources */,
-				C986D3F8296288C400EBD4DF /* CPDFBackgroundPreview.m in Sources */,
+				C92BA1972963F84B009954EF /* PDFDrawImageView.m in Sources */,
+				ECD0ABF52928ED9A0091B6EB /* PDFImagePreview.m in Sources */,
+				ECD0AC32292B56C90091B6EB /* PDFDataModel.m in Sources */,
+				ECD0ABF42928ED9A0091B6EB /* PDFTextView.m in Sources */,
+				ECD0ABF32928ED9A0091B6EB /* PDFImageView.m in Sources */,
+				C95FE7682966F6000038BBF3 /* PDFHeaderFooterAddView.m in Sources */,
+				C986D3F8296288C400EBD4DF /* PDFBackgroundPreview.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 0 - 1
PDFViewer/AppDelegate.m

@@ -14,7 +14,6 @@
 
 @implementation AppDelegate
 
-
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     // Override point for customization after application launch.
     [CPDFKit setLicenseKey:@"d2rW7BdT+peaa/hxOm4N/PYo5lotThkuHWjzZs4IXTOdY7Wss9Vk/lZni8H4rKu7t/RMjwDlJIXKIqzwOO0h2IakMBU5cy12KJhwgKRGBL2rBSN7GpOoZTufmlxsrj6RWP60/mQ39ZQiTAjx4eTVL9VwudIk/2Zj7YfhVweCJN0=" secret:@"mG0c3O3Mzeu5dkZJW3gpql8+jBucojBtBSjI3YJz2gAQurxTxGuBlGAhs0P1mD3XKqvsLa4npVLfI/mo45dkJ5QFcNndGDskT70Jc2iwVo5hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6ccsvUiEnSpVC16x66CLYBR9nL4G5ayY1Yw9IbVniEuzaCCVg1bqAdLSXAjS4mxI/QshmpPEP0qS8yPf877NfXnm6gW/UFOMJ5eWQQ5IO+aCVQ=="];

+ 19 - 0
PDFViewer/Controller/Background/Watermark/PDFWatermarkControllerHeader.h

@@ -0,0 +1,19 @@
+//
+//  CPDFWatermarkControllerHeader.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/12.
+//
+
+#ifndef PDFWatermarkControllerHeader_h
+#define PDFWatermarkControllerHeader_h
+
+@interface PDFWatermarkViewController ()
+
+- (BOOL)validateValue:(NSString *)number;
+- (void)onSelectPageRange:(UIButton *)sender;
+- (void)createCustomRangeAlert;
+
+@end
+
+#endif /* CPDFWatermarkControllerHeader_h */

+ 19 - 0
PDFViewer/Controller/Background/Watermark/PDFWatermarkViewController.h

@@ -0,0 +1,19 @@
+//
+//  CPDFWatermarkViewController.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/12.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFDataModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFWatermarkViewController : UIViewController
+
+@property (nonatomic,strong) PDFDataModel *dataModel;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 82 - 0
PDFViewer/Controller/Background/Watermark/PDFWatermarkViewController.m

@@ -0,0 +1,82 @@
+//
+//  CPDFWatermarkViewController.m
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/12.
+//
+
+#import "PDFWatermarkViewController.h"
+#import "PDFWatermarkControllerHeader.h"
+
+@interface PDFWatermarkViewController ()
+
+@end
+
+@implementation PDFWatermarkViewController
+
+#pragma mark - UIViewController Methods
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    _dataModel = [[PDFDataModel alloc] init];
+    
+    [self initDataModel];
+}
+
+- (void)initDataModel {
+    
+}
+
+- (void)onSelectPageRange:(UIButton *)sender {
+    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+    UIAlertAction *defaultRange = [UIAlertAction actionWithTitle:@"All Pages" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+        }];
+    UIAlertAction *customRange = [UIAlertAction actionWithTitle:@"Custom Page Range" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        [self createCustomRangeAlert];
+        }];
+    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+            
+        }];
+    [alertController addAction:defaultRange];
+    [alertController addAction:customRange];
+    [alertController addAction:cancelAction];
+    [self presentViewController:alertController animated:YES completion:nil];
+}
+
+- (void)createCustomRangeAlert {
+    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Custom Page Range" message:nil preferredStyle:UIAlertControllerStyleAlert];
+    
+    [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
+        textField.placeholder = @"such as:1,3-5,10";
+    }];
+    [alertController addAction:[UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+        self.dataModel.pageString = alertController.textFields.firstObject.text;
+    }]];
+    [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+    }]];
+    [self presentViewController:alertController animated:YES completion:nil];
+}
+
+- (BOOL)validateValue:(NSString *)number {
+    BOOL res = YES;
+    NSCharacterSet *numberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
+    
+    NSInteger i = 0;
+    while (i < number.length) {
+        NSString *str = [number substringWithRange:NSMakeRange(i, 1)];
+        NSRange range = [str rangeOfCharacterFromSet:numberSet];
+        
+        if (range.length == 0) {
+            res = NO;
+            break;
+        }
+        i++;
+    }
+    
+    return  res;
+}
+
+@end

+ 0 - 36
PDFViewer/Controller/CPDFAddWaterMarkViewController.h

@@ -1,36 +0,0 @@
-//
-//  CPDFAddViewController.h
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/12/15.
-//  Alter cause : code standards
-
-#import <UIKit/UIKit.h>
-#import <ComPDFKit/ComPDFKit.h>
-#import "CPDFDataModel.h"
-#import "CPDFTextViewController.h"
-#import "CPDFImageViewController.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@protocol WaterMarkModelDataDelegate <NSObject>
-
-- (void)changeTextModel:(CPDFDataModel *)dataModel;
-- (void)deleteTextModel:(CPDFWatermark *)waterMark;
-- (void)changeImageModel:(CPDFDataModel *)dataModel;
-
-@end
-
-@interface CPDFAddWaterMarkViewController : UIViewController
-
-@property (nonatomic,strong) UISegmentedControl *segmentedControl;
-@property (nonatomic,strong) id<WaterMarkModelDataDelegate> delegate;
-@property (nonatomic,strong) CPDFTextViewController *textViewController;
-@property (nonatomic,strong) CPDFImageViewController *imageViewController;
-@property (nonatomic,strong) CPDFDocument *document;
-
-- (instancetype)initWithDocument:(CPDFDocument *)document;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 33
PDFViewer/Controller/CPDFImageViewController.h

@@ -1,33 +0,0 @@
-//
-//  CPDFImageViewController.h
-//  PDFViewer
-//
-//  Created by kdan on 2022/11/19.
-//
-
-#import <UIKit/UIKit.h>
-
-
-@class CPDFImagePreview;
-@class CPDFImageView;
-@class CPDFDataModel;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface CPDFImageViewController : UIViewController
-
-@property (nonatomic,strong) CPDFImagePreview *imagePreview;
-@property (nonatomic,strong) CPDFImageView *imageView;
-@property (nonatomic,strong) CPDFDataModel *dataModel;
-
-- (void)initDataModel;
-- (void)addTargets;
-- (void)addConstraint;
-- (void)createGestureRecognizer;
-- (void)createCustomRangeAlert;
-
-- (UIImage *)imageWithImageSimple:(UIImage *)image scaledToSize:(CGSize)newSize;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 32
PDFViewer/Controller/CPDFTextViewController.h

@@ -1,32 +0,0 @@
-//
-//  CPDFTextViewController.h
-//  PDFViewer
-//
-//  Created by kdan on 2022/11/19.
-//
-
-#import <UIKit/UIKit.h>
-#import "CPDFTextPreview.h"
-
-@class CPDFTextPreview;
-@class CPDFTextView;
-@class CPDFDataModel;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface CPDFTextViewController : UIViewController 
-
-@property (nonatomic,strong) CPDFTextPreview *textPreview;
-@property (nonatomic,strong) CPDFTextView *textView;
-@property (nonatomic,strong) CPDFDataModel *dataModel;
-@property (nonatomic,strong) UIAlertController *alertController;
-
-- (void)initDataModel;
-- (void)addTargets;
-- (void)addConstraint;
-- (void)createGestureRecognizer;
-- (void)createCustomRangeAlert;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 48
PDFViewer/Controller/HeaderFooter/CPDFAddViewController.h

@@ -1,48 +0,0 @@
-//
-//  CPDFAddViewController.h
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/12/7.
-//
-
-#import <UIKit/UIKit.h>
-#import "CPDFHeaderFooterModel.h"
-#import "CPDFHeadView.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-#define kFormat @"^[ ]+$"
-
-typedef enum CGLocation {
-    kHeader = 0,
-    kFooter,
-}CGLocation;
-
-typedef enum CGAligment {
-    kLeft = 0,
-    kCenter,
-    kRinght,
-}CGAligment;
-
-typedef struct RecPosition {
-    CGLocation location;
-    CGAligment aligment;
-}RecPosition;
-
-@protocol CPDFModelDataDelegate <NSObject>
-
-@optional
-- (void)changeHeaderFooterModelData:(CPDFHeaderFooterModel *)modelData;
-- (void)changBatesModelData:(CPDFHeaderFooterModel *)modelData;
-
-@end
-
-@interface CPDFAddViewController : UIViewController
-
-- (id)initWithImage:(UIImage *)image;
-
-@property (nonatomic,weak) id<CPDFModelDataDelegate> delegate;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 19
PDFViewer/Controller/HeaderFooter/CPDFBatesAddViewController.h

@@ -1,19 +0,0 @@
-//
-//  BatesAddViewController.h
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/11/18.
-//
-
-#import <UIKit/UIKit.h>
-#import "CPDFBatesAddView.h"
-#import "CPDFHeaderFooterAddController.h"
-#import "CPDFAddWaterMarkViewController.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface CPDFBatesAddViewController : CPDFAddViewController <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 21
PDFViewer/Controller/HeaderFooter/CPDFHeaderFooterAddController.h

@@ -1,21 +0,0 @@
-//
-//  HeaderFooterAlertViewController.h
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/11/16.
-//
-
-#import <UIKit/UIKit.h>
-#import "CPDFHeaderFooterAddView.h"
-#import "CPDFHeaderFooterModel.h"
-#import "CPDFHeaderFooterTextTableView.h"
-#import "Masonry.h"
-#import "CPDFAddViewController.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface CPDFHeaderFooterAddController : CPDFAddViewController  <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 48 - 0
PDFViewer/Controller/HeaderFooter/PDFAddViewController.h

@@ -0,0 +1,48 @@
+//
+//  CPDFAddViewController.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/12/7.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFHeaderFooterModel.h"
+#import "PDFHeadView.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+#define kFormat @"^[ ]+$"
+
+typedef NS_ENUM(NSInteger, PDFHeaderFooterLocation) {
+    PDFHeader = 0,
+    PDFFooter,
+};
+
+typedef NS_ENUM(NSInteger, PDFHeaderFooerAligment) {
+    PDFLeft = 0,
+    PDFCenter,
+    PDFRinght,
+};
+
+typedef struct PDFHeaderFooterPosition {
+    PDFHeaderFooterLocation location;
+    PDFHeaderFooerAligment aligment;
+}PDFHeaderFooterPosition;
+
+@protocol PDFModelDataDelegate <NSObject>
+
+@optional
+- (void)PDFViewPerformChangeHeaderFooter:(PDFHeaderFooterModel *)modelData;
+- (void)PDFViewPerformChangBates:(PDFHeaderFooterModel *)modelData;
+
+@end
+
+@interface PDFAddViewController : UIViewController
+
+- (id)initWithImage:(UIImage *)image;
+
+@property (nonatomic,weak) id<PDFModelDataDelegate> delegate;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 54 - 51
PDFViewer/Controller/HeaderFooter/CPDFAddViewController.m

@@ -5,17 +5,19 @@
 //  Created by kdanmobile_2 on 2022/12/7.
 //
 
-#import "CPDFAddViewController.h"
-#import "CPDFAddViewControllerHeader.h"
-#import "CPDFAddView.h"
+#import "PDFAddViewController.h"
+#import "PDFAddViewControllerHeader.h"
+#import "PDFAddView.h"
 
-@interface CPDFAddViewController ()
+@interface PDFAddViewController ()
 
-@property (nonatomic,strong) CPDFAddView *buttonView;
+@property (nonatomic,strong) PDFAddView *buttonView;
 
 @end
 
-@implementation CPDFAddViewController
+@implementation PDFAddViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
@@ -53,7 +55,7 @@
 }
 
 - (void)initModel {
-    _modelData = [[CPDFHeaderFooterModel alloc] init];
+    _modelData = [[PDFHeaderFooterModel alloc] init];
     _modelData.fontSize = 18.0;
     _modelData.fontSelcet = 0;
     _modelData.fontPosition = 0;
@@ -61,7 +63,8 @@
 }
 
 - (void)initHeadView {
-    _headView = [[CPDFHeadView alloc] init];
+    _headView = [[PDFHeadView alloc] init];
+    _headView.documentView.image = self.image;
     [_headView setImage:self.image];
     [self.view addSubview:_headView];
 
@@ -84,7 +87,7 @@
 }
 
 - (void)initBttonmView {
-    _buttonView = [[CPDFAddView alloc] init];
+    _buttonView = [[PDFAddView alloc] init];
     [self.view addSubview:_buttonView];
     
     [self.buttonView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -127,7 +130,7 @@
 // Get headerfoote's font size for headerfooter's Model
 - (void)changeFontSize:(UITextField *)text {
     float size = [text.text floatValue];
-    _headView.showLabel.font = [UIFont systemFontOfSize:size / 3];
+    _headView.preLabel.font = [UIFont systemFontOfSize:size / 3];
     _modelData.fontSize = size;
     [self showPages];
 }
@@ -136,43 +139,43 @@
 - (void)sliderChange:(UISlider *)slider {
     switch ((int)slider.value / 10) {
         case 0:
-            self.headView.showLabel.textColor = [UIColor redColor];
+            self.headView.preLabel.textColor = [UIColor redColor];
             self.modelData.fontColor = [UIColor redColor];
             break;
         case 1:
-            self.headView.showLabel.textColor = [UIColor orangeColor];
+            self.headView.preLabel.textColor = [UIColor orangeColor];
             self.modelData.fontColor = [UIColor orangeColor];
             break;
         case 2:
-            self.headView.showLabel.textColor = [UIColor colorWithRed:239.0 / 255 green:140.0 / 255 blue:133.0 / 255 alpha:1];
+            self.headView.preLabel.textColor = [UIColor colorWithRed:239.0 / 255 green:140.0 / 255 blue:133.0 / 255 alpha:1];
             self.modelData.fontColor = [UIColor colorWithRed:239.0 / 255 green:140.0 / 255 blue:133.0 / 255 alpha:1];
             break;
         case 3:
-            self.headView.showLabel.textColor = [UIColor yellowColor];
+            self.headView.preLabel.textColor = [UIColor yellowColor];
             self.modelData.fontColor = [UIColor yellowColor];;
             break;
         case 4:
-            self.headView.showLabel.textColor = [UIColor greenColor];
+            self.headView.preLabel.textColor = [UIColor greenColor];
             self.modelData.fontColor = [UIColor greenColor];
             break;
         case 5:
-            self.headView.showLabel.textColor = [UIColor blueColor];
+            self.headView.preLabel.textColor = [UIColor blueColor];
             self.modelData.fontColor = [UIColor blueColor];
             break;
         case 6:
-            self.headView.showLabel.textColor = [UIColor purpleColor];
+            self.headView.preLabel.textColor = [UIColor purpleColor];
             self.modelData.fontColor = [UIColor purpleColor];
             break;
         case 7:
-            self.headView.showLabel.textColor = [UIColor colorWithRed:235.0 / 255 green:61.0 / 255 blue:133.0 / 255 alpha:1];
+            self.headView.preLabel.textColor = [UIColor colorWithRed:235.0 / 255 green:61.0 / 255 blue:133.0 / 255 alpha:1];
             self.modelData.fontColor = [UIColor colorWithRed:235.0 / 255 green:61.0 / 255 blue:133.0 / 255 alpha:1];
             break;
         case 8:
-            self.headView.showLabel.textColor = [UIColor blackColor];
+            self.headView.preLabel.textColor = [UIColor blackColor];
             self.modelData.fontColor = [UIColor blackColor];
             break;
         case 9:
-            self.headView.showLabel.textColor = [UIColor whiteColor];
+            self.headView.preLabel.textColor = [UIColor whiteColor];
             self.modelData.fontColor = [UIColor whiteColor];
             break;
         default:
@@ -183,9 +186,9 @@
 // Select headerfooter
 - (void)changeLocation:(UISegmentedControl *)sender {
     if (sender.selectedSegmentIndex == 0) {
-        _position.location = kHeader;
+        _position.location = PDFHeader;
     } else {
-        _position.location = kFooter;
+        _position.location = PDFFooter;
     }
     [self showPages];
 }
@@ -193,43 +196,43 @@
 // Select aligment
 - (void)changeAligbment:(UISegmentedControl *)sender {
     if (sender.selectedSegmentIndex == 0) {
-        _position.aligment = kLeft;
+        _position.aligment = PDFLeft;
     } else if (sender.selectedSegmentIndex == 1) {
-        _position.aligment = kCenter;
+        _position.aligment = PDFCenter;
     } else {
-        _position.aligment = kRinght;
+        _position.aligment = PDFRinght;
     }
     [self showPages];
 }
 
 // Show headerfooter and aligment
 - (void)showPages {
-    if (_headView.showLabel == nil) {
-        _headView.showLabel = [[UILabel alloc] init];
+    if (_headView.preLabel == nil) {
+        _headView.preLabel = [[UILabel alloc] init];
     }
     
     switch (self.position.location) {
-        case kHeader:
-            if (self.position.aligment == kLeft) {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(0.5);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(0.5);
+        case PDFHeader:
+            if (self.position.aligment == PDFLeft) {
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(0.5);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(0.5);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];
                 self.modelData.fontPosition = 0;
-            } else if (self.position.aligment == kCenter) {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(0.5);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(self.image.size.width / 18);
+            } else if (self.position.aligment == PDFCenter) {
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(0.5);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(self.image.size.width / 18);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];
                 self.modelData.fontPosition = 1;
             } else {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(0.5);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(self.image.size.width / 9 - 12);
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(0.5);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(self.image.size.width / 9 - 12);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];
@@ -237,27 +240,27 @@
             }
             break;
             
-        case kFooter:
-            if (self.position.aligment == kLeft) {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(self.image.size.height / 9 - 12);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(0.5);
+        case PDFFooter:
+            if (self.position.aligment == PDFLeft) {
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(self.image.size.height / 9 - 12);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(0.5);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];
                 self.modelData.fontPosition = 3;
-            } else if (self.position.aligment == kCenter) {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(self.image.size.height / 9 - 12);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(self.image.size.width / 18);
+            } else if (self.position.aligment == PDFCenter) {
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(self.image.size.height / 9 - 12);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(self.image.size.width / 18);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];
                 self.modelData.fontPosition = 4;
             } else {
-                [_headView.showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-                    make.top.equalTo(self.headView.imageView.mas_top).offset(self.image.size.height / 9 - 12);
-                    make.left.equalTo(self.headView.imageView.mas_left).offset(self.image.size.width / 9 - 12);
+                [_headView.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                    make.top.equalTo(self.headView.documentView.mas_top).offset(self.image.size.height / 9 - 12);
+                    make.left.equalTo(self.headView.documentView.mas_left).offset(self.image.size.width / 9 - 12);
                     make.height.mas_equalTo(10);
                     make.width.mas_equalTo(20);
                 }];

+ 9 - 9
PDFViewer/Controller/HeaderFooter/CPDFAddViewControllerHeader.h

@@ -5,15 +5,15 @@
 //  Created by kdanmobile_2 on 2022/12/8.
 //
 
-#ifndef CPDFAddViewControllerHeader_h
-#define CPDFAddViewControllerHeader_h
+#ifndef PDFAddViewControllerHeader_h
+#define PDFAddViewControllerHeader_h
 
 #import <UIKit/UIKit.h>
-#import "CPDFHeaderFooterModel.h"
-#import "CPDFAddViewController.h"
-#import "CPDFHeadView.h"
+#import "PDFHeaderFooterModel.h"
+#import "PDFAddViewController.h"
+#import "PDFHeadView.h"
 
-@interface CPDFAddViewController ()
+@interface PDFAddViewController ()
 
 - (void)initNavigation;
 - (void)cancelClick:(UIBarButtonItem *)btn;
@@ -24,9 +24,9 @@
 - (void)initHeadView;
  
 @property (nonatomic,strong) UIImage *image;
-@property (nonatomic,assign) RecPosition position;
-@property (nonatomic,strong) CPDFHeadView *headView;
-@property (nonatomic,strong) CPDFHeaderFooterModel *modelData;
+@property (nonatomic,assign) PDFHeaderFooterPosition position;
+@property (nonatomic,strong) PDFHeadView *headView;
+@property (nonatomic,strong) PDFHeaderFooterModel *modelData;
 
 @end
 

+ 19 - 0
PDFViewer/Controller/HeaderFooter/PDFBatesAddViewController.h

@@ -0,0 +1,19 @@
+//
+//  BatesAddViewController.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/11/18.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFBatesAddView.h"
+#import "PDFHeaderFooterAddController.h"
+#import "PDFAddWaterMarkViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFBatesAddViewController : PDFAddViewController <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 22 - 20
PDFViewer/Controller/HeaderFooter/CPDFBatesAddViewController.m

@@ -5,18 +5,20 @@
 //  Created by kdanmobile_2 on 2022/11/18.
 //
 
-#import "CPDFBatesAddViewController.h"
-#import "CPDFAddViewControllerHeader.h"
+#import "PDFBatesAddViewController.h"
+#import "PDFAddViewControllerHeader.h"
 
-@interface CPDFBatesAddViewController ()
+@interface PDFBatesAddViewController ()
 
-@property (nonatomic,strong) CPDFHeaderFooterTextTableView *fontName;
+@property (nonatomic,strong) PDFHeaderFooterTextTableView *fontName;
 @property (nonatomic,strong) NSMutableArray *dataArray;
-@property (nonatomic,strong) CPDFBatesAddView *batesAddView;
+@property (nonatomic,strong) PDFBatesAddView *batesAddView;
 
 @end
 
-@implementation CPDFBatesAddViewController
+@implementation PDFBatesAddViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
@@ -34,7 +36,7 @@
 }
 
 - (void)initModel {
-    self.modelData = [[CPDFHeaderFooterModel alloc] init];
+    self.modelData = [[PDFHeaderFooterModel alloc] init];
     self.modelData.fontName = @"Helvetica";
     self.modelData.fontPosition = 0;
     self.modelData.fontText = @"#2#1#0#0";
@@ -42,10 +44,10 @@
 }
 
 - (void)initBttonmView {
-    _batesAddView = [[CPDFBatesAddView alloc] init];
+    _batesAddView = [[PDFBatesAddView alloc] init];
     [_batesAddView setText];
     [self.view addSubview:_batesAddView];
-    self.headView.showLabel.text = @"0010";
+    self.headView.preLabel.text = @"0010";
     
     if (([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight) || ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) || ([UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown) || (self.view.frame.size.width > self.view.frame.size.height)) {
         [self.batesAddView mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -78,11 +80,11 @@
     [_batesAddView.pageIndexNumberText addTarget:self action:@selector(changePageStart:) forControlEvents:UIControlEventEditingChanged];
     [_batesAddView.pageNumberText addTarget:self action:@selector(changeText:) forControlEvents:UIControlEventEditingChanged];
     
-    [_batesAddView.pageNumberText addTarget:self action:@selector(viewUp) forControlEvents:UIControlEventEditingDidBegin];
-    [_batesAddView.pageIndexNumberText addTarget:self action:@selector(viewUp) forControlEvents:UIControlEventEditingDidBegin];
+    [_batesAddView.pageNumberText addTarget:self action:@selector(PDFBatesAddViewUp) forControlEvents:UIControlEventEditingDidBegin];
+    [_batesAddView.pageIndexNumberText addTarget:self action:@selector(PDFBatesAddViewUp) forControlEvents:UIControlEventEditingDidBegin];
     
-    [_batesAddView.pageNumberText addTarget:self action:@selector(viewDown) forControlEvents:UIControlEventEditingDidEnd];
-    [_batesAddView.pageIndexNumberText addTarget:self action:@selector(viewDown) forControlEvents:UIControlEventEditingDidEnd];
+    [_batesAddView.pageNumberText addTarget:self action:@selector(PDFBatesAddViewDown) forControlEvents:UIControlEventEditingDidEnd];
+    [_batesAddView.pageIndexNumberText addTarget:self action:@selector(PDFBatesAddViewDown) forControlEvents:UIControlEventEditingDidEnd];
     
     _batesAddView.fontNameText.delegate = self;
 }
@@ -104,7 +106,7 @@
 #pragma mark - UITextFieldDelegate
 
 - (void)textFieldDidBeginEditing:(UITextField *)textField {
-    _fontName = [[CPDFHeaderFooterTextTableView alloc] initWithTitleName:@"Font Name"];
+    _fontName = [[PDFHeaderFooterTextTableView alloc] initWithTitleName:@"Font Name"];
     
     _fontName.tableView.delegate = self;
     _fontName.tableView.dataSource = self;
@@ -170,15 +172,15 @@
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     self.modelData.fontName = self.dataArray[indexPath.row];
     
-    self.headView.showLabel.font = [UIFont fontWithName:self.dataArray[indexPath.row] size:5];
+    self.headView.preLabel.font = [UIFont fontWithName:self.dataArray[indexPath.row] size:5];
 }
 
 #pragma mark - Actions
 
 // Done button enable
 - (void)doneBatesClick:(UIBarButtonItem *)btn {
-    if ([self.delegate respondsToSelector:@selector(changBatesModelData:)]) {
-        [self.delegate changBatesModelData:self.modelData];
+    if ([self.delegate respondsToSelector:@selector(PDFViewPerformChangBates:)]) {
+        [self.delegate PDFViewPerformChangBates:self.modelData];
     }
     [self.navigationController popViewControllerAnimated:YES];
 }
@@ -218,7 +220,7 @@
         showText = [NSString stringWithFormat:@"%@%@",showText,textArray[4]];
     }
     
-    self.headView.showLabel.text = showText;
+    self.headView.preLabel.text = showText;
     self.modelData.fontText = text.text;
 }
 
@@ -228,7 +230,7 @@
     self.modelData.pageStart = [NSString stringWithFormat:@"%d",start - 1];
 }
 
-- (void)viewUp {
+- (void)PDFBatesAddViewUp {
     [self.batesAddView mas_remakeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(self.view).offset(125);
         make.left.equalTo(self.view.mas_left);
@@ -241,7 +243,7 @@
     } completion:nil];
 }
 
-- (void)viewDown {
+- (void)PDFBatesAddViewDown {
     [self.batesAddView mas_remakeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(self.headView.mas_bottom).offset(26);
         make.left.equalTo(self.view.mas_left);

+ 21 - 0
PDFViewer/Controller/HeaderFooter/PDFHeaderFooterAddController.h

@@ -0,0 +1,21 @@
+//
+//  HeaderFooterAlertViewController.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/11/16.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFHeaderFooterAddView.h"
+#import "PDFHeaderFooterModel.h"
+#import "PDFHeaderFooterTextTableView.h"
+#import "Masonry.h"
+#import "PDFAddViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFHeaderFooterAddController : PDFAddViewController  <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 22 - 21
PDFViewer/Controller/HeaderFooter/CPDFHeaderFooterAddController.m

@@ -5,18 +5,20 @@
 //  Created by kdanmobile_2 on 2022/11/16.
 //
 
-#import "CPDFHeaderFooterAddController.h"
-#import "CPDFAddViewControllerHeader.h"
+#import "PDFHeaderFooterAddController.h"
+#import "PDFAddViewControllerHeader.h"
 
-@interface CPDFHeaderFooterAddController ()
+@interface PDFHeaderFooterAddController ()
 
-@property (nonatomic,strong) CPDFHeaderFooterAddView *headerFooterview;
-@property (nonatomic,strong) CPDFHeaderFooterTextTableView *pageFormat;
+@property (nonatomic,strong) PDFHeaderFooterAddView *headerFooterview;
+@property (nonatomic,strong) PDFHeaderFooterTextTableView *pageFormat;
 @property (nonatomic,strong) NSMutableArray *dataArray;
 
 @end
 
-@implementation CPDFHeaderFooterAddController
+@implementation PDFHeaderFooterAddController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad { 
     [super viewDidLoad];
@@ -28,7 +30,7 @@
 #pragma mark - Initializers
 
 - (void)initModel {
-    self.modelData = [[CPDFHeaderFooterModel alloc] init];
+    self.modelData = [[PDFHeaderFooterModel alloc] init];
     self.modelData.fontSize = 18.0;
     self.modelData.fontSelcet = 0;
     self.modelData.fontPosition = 0;
@@ -36,11 +38,10 @@
 }
 
 - (void)initBttonmView {
-    _headerFooterview = [[CPDFHeaderFooterAddView alloc] init];
+    _headerFooterview = [[PDFHeaderFooterAddView alloc] init];
     [_headerFooterview setText];
     [self.view addSubview:_headerFooterview];
     
-    
     if (([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight) || ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) || ([UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown) || (self.view.frame.size.width > self.view.frame.size.height)) {
         [self.headerFooterview mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.view.mas_top).offset(15);
@@ -71,11 +72,11 @@
     [_headerFooterview.fontSizeText addTarget:self action:@selector(changeFontSize:) forControlEvents:UIControlEventEditingChanged];
     [_headerFooterview.pageIndexNumberText addTarget:self action:@selector(changePageStart:) forControlEvents:UIControlEventEditingChanged];
     
-    [_headerFooterview.fontSizeText addTarget:self action:@selector(viewUp) forControlEvents:UIControlEventEditingDidBegin];
-    [_headerFooterview.pageIndexNumberText addTarget:self action:@selector(viewUp) forControlEvents:UIControlEventEditingDidBegin];
+    [_headerFooterview.fontSizeText addTarget:self action:@selector(PDFHeaderFooterAddViewUp) forControlEvents:UIControlEventEditingDidBegin];
+    [_headerFooterview.pageIndexNumberText addTarget:self action:@selector(PDFHeaderFooterAddViewUp) forControlEvents:UIControlEventEditingDidBegin];
     
-    [_headerFooterview.fontSizeText addTarget:self action:@selector(viewDown) forControlEvents:UIControlEventEditingDidEnd];
-    [_headerFooterview.pageIndexNumberText addTarget:self action:@selector(viewDown) forControlEvents:UIControlEventEditingDidEnd];
+    [_headerFooterview.fontSizeText addTarget:self action:@selector(PDFHeaderFooterAddViewDown) forControlEvents:UIControlEventEditingDidEnd];
+    [_headerFooterview.pageIndexNumberText addTarget:self action:@selector(PDFHeaderFooterAddViewDown) forControlEvents:UIControlEventEditingDidEnd];
     
     _headerFooterview.pageNumberText.delegate = self;
 }
@@ -98,7 +99,7 @@
 
 // TableView initialize
 - (void)textFieldDidBeginEditing:(UITextField *)textField {
-    _pageFormat = [[CPDFHeaderFooterTextTableView alloc] initWithTitleName:@"Format Selection"];
+    _pageFormat = [[PDFHeaderFooterTextTableView alloc] initWithTitleName:@"Format Selection"];
     
     _pageFormat.tableView.delegate = self;
     _pageFormat.tableView.dataSource = self;
@@ -163,7 +164,7 @@
     
     self.modelData.fontSelcet = indexPath.row;
     
-    self.headView.showLabel.text = self.dataArray[indexPath.row];
+    self.headView.preLabel.text = self.dataArray[indexPath.row];
     [self showPages];
 }
 
@@ -176,15 +177,15 @@
 
 // Done button enable
 - (void)doneClick:(UIBarButtonItem *)btn {
-    if ([self.delegate respondsToSelector:@selector(changeHeaderFooterModelData:)]) {
-        [self.delegate changeHeaderFooterModelData:self.modelData];
+    if ([self.delegate respondsToSelector:@selector(PDFViewPerformChangeHeaderFooter:)]) {
+        [self.delegate PDFViewPerformChangeHeaderFooter:self.modelData];
     }
     
     [self.navigationController popViewControllerAnimated:YES];
 }
 
 - (void)pageFormatOk:(UIButton *)okBtn {
-    self.headerFooterview.pageNumberText.text = self.headView.showLabel.text;
+    self.headerFooterview.pageNumberText.text = self.headView.preLabel.text;
     [self.pageFormat removeFromSuperview];
 }
 
@@ -199,11 +200,11 @@
 // Get headerfoote's font size for headerfooter's Model
 - (void)changeFontSize:(UITextField *)text {
     float size = [text.text floatValue];
-    self.headView.showLabel.font = [UIFont systemFontOfSize:size / 3];
+    self.headView.preLabel.font = [UIFont systemFontOfSize:size / 3];
     self.modelData.fontSize = size;
 }
 
-- (void)viewUp {
+- (void)PDFHeaderFooterAddViewUp {
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown) {
         
     } else {
@@ -221,7 +222,7 @@
     
 }
 
-- (void)viewDown {
+- (void)PDFHeaderFooterAddViewDown {
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown) {
         
     } else {

+ 34 - 0
PDFViewer/Controller/PDFAddWaterMarkViewController.h

@@ -0,0 +1,34 @@
+//
+//  CPDFAddViewController.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/12/15.
+//  Alter cause : code standards
+
+#import <UIKit/UIKit.h>
+#import <ComPDFKit/ComPDFKit.h>
+#import "PDFTextViewController.h"
+#import "PDFImageViewController.h"
+#import "PDFDataModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol WaterMarkModelDataDelegate <NSObject>
+
+- (void)PDFViewPerformChangeTextWatermark:(PDFDataModel *)dataModel;
+- (void)PDFViewPerformDeleteWatermark:(CPDFWatermark *)waterMark;
+- (void)PDFViewPerformChangeImageWatermark:(PDFDataModel *)dataModel;
+
+@end
+
+@interface PDFAddWaterMarkViewController : UIViewController
+
+@property (nonatomic,strong) id<WaterMarkModelDataDelegate> delegate;
+@property (nonatomic,strong) PDFTextViewController *textViewController;
+@property (nonatomic,strong) PDFImageViewController *imageViewController;
+
+- (instancetype)initWithDocument:(CPDFDocument *)document;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 114 - 160
PDFViewer/Controller/CPDFAddWaterMarkViewController.m

@@ -5,29 +5,33 @@
 //  Created by kdanmobile_2 on 2022/12/15.
 // 
 
-#import "CPDFAddWaterMarkViewController.h"
+#import "PDFAddWaterMarkViewController.h"
 #import <ComPDFKit/ComPDFKit.h>
 #import <ComPDFKit/CPDFWatermark.h>
-#import "CPDFViewController.h"
-#import "CPDFTextView.h"
-#import "CPDFTextPreview.h"
-#import "CPDFImageView.h"
-#import "CPDFImagePreview.h"
-#import "CPDFDataModel.h"
-#import "CPDFEditView.h"
+#import "PDFViewController.h"
+#import "PDFTextView.h"
+#import "PDFTextPreview.h"
+#import "PDFImageView.h"
+#import "PDFImagePreview.h"
+#import "PDFDataModel.h"
+#import "PDFEditView.h"
 #import "Masonry.h"
 
-@interface CPDFAddWaterMarkViewController () <UITableViewDelegate,UITableViewDataSource>
+@interface PDFAddWaterMarkViewController () <UITableViewDelegate,UITableViewDataSource>
 
 @property (nonatomic,assign) CGSize imageSize;
 @property (nonatomic,strong) UIImage *image;
-@property (nonatomic,strong) CPDFDataModel *dataModel;
-@property (nonatomic,strong) CPDFEditView *editView;
+@property (nonatomic,strong) PDFDataModel *dataModel;
+@property (nonatomic,strong) PDFEditView *editView;
 @property (nonatomic,strong) NSMutableArray *dataArray;
+@property (nonatomic,strong) CPDFDocument *document;
+@property (nonatomic,strong) UISegmentedControl *segmentedControl;
 
 @end
 
-@implementation CPDFAddWaterMarkViewController
+@implementation PDFAddWaterMarkViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
@@ -69,8 +73,8 @@
     
     [_segmentedControl setBackgroundColor:[UIColor whiteColor]];
     
-    _textViewController = [[CPDFTextViewController alloc] init];
-    _imageViewController = [[CPDFImageViewController alloc] init];
+    _textViewController = [[PDFTextViewController alloc] init];
+    _imageViewController = [[PDFImageViewController alloc] init];
     
     [self addChildViewController:_textViewController];
     [self addChildViewController:_imageViewController];
@@ -79,7 +83,7 @@
     [self.view addSubview:_textViewController.view];
     [self.view addSubview:_imageViewController.view];
     
-    _editView = [[CPDFEditView alloc] init];
+    _editView = [[PDFEditView alloc] init];
     _editView.editTableView.dataSource = self;
     _editView.editTableView.delegate = self;
     
@@ -95,99 +99,10 @@
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown || (self.view.frame.size.width > self.view.frame.size.height)) {
         [self addSideConstraint];
     } else {
-        [self addNomalConstraint];
+        [self addNormalConstraint];
     }
 }
 
-- (void)addSideConstraint {
-    [_segmentedControl mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_top).offset(43.6);
-        make.width.equalTo(self.view.mas_width);
-        make.height.equalTo(@(self.view.bounds.size.height / 13));
-    }];
-    
-    [_textViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
-        make.width.equalTo(_segmentedControl.mas_width);
-        make.bottom.equalTo(self.view).offset(-34);
-    }];
-    [_imageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
-        make.width.equalTo(_segmentedControl.mas_width);
-        make.bottom.equalTo(self.view).offset(-34);
-    }];
-    
-    [_textViewController.textView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.right.equalTo(self.view.mas_right).offset(-38);
-        make.height.equalTo(@205);
-        make.width.equalTo(@393);
-        make.bottom.equalTo(self.view.mas_bottom).offset(-74);
-    }];
-    [_textViewController.textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.segmentedControl.mas_bottom).offset(0);
-        make.right.equalTo(_textViewController.textView.mas_left).offset(-5);
-        make.left.equalTo(self.view.mas_left).offset(0);
-        make.bottom.equalTo(self.view.mas_bottom).offset(-34);
-    }];
-    
-    [_imageViewController.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.right.equalTo(self.view.mas_right).offset(-38);
-        make.height.equalTo(@205);
-        make.width.equalTo(@393);
-        make.bottom.equalTo(self.view.mas_bottom).offset(-74);
-    }];
-    [_imageViewController.imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.segmentedControl.mas_bottom).offset(0);
-        make.right.equalTo(_imageViewController.imageView.mas_left).offset(-5);
-        make.left.equalTo(self.view.mas_left).offset(0);
-        make.bottom.equalTo(self.view.mas_bottom).offset(-34);
-    }];
-    
-    [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
-        make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
-        make.width.equalTo(@(_imageSize.width / 10));
-        make.height.equalTo(@(_imageSize.height / 10));
-    }];
-    [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
-        make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
-        make.width.equalTo(@(_imageSize.width / 10));
-        make.height.equalTo(@(_imageSize.height / 10));
-    }];
-}
-
-- (void)addNomalConstraint {
-    [_segmentedControl mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_top).offset(83.6);
-        make.width.equalTo(self.view.mas_width);
-        make.height.equalTo(@(self.view.bounds.size.height / 20));
-    }];
-    
-    [_textViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
-        make.width.equalTo(_segmentedControl.mas_width);
-        make.bottom.equalTo(self.view).offset(-34);
-    }];
-    [_imageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
-        make.width.equalTo(_segmentedControl.mas_width);
-        make.bottom.equalTo(self.view).offset(-34);
-    }];
-    [_textViewController.textPreview.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
-        make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
-        make.width.equalTo(@(_imageSize.width / 8));
-        make.height.equalTo(@(_imageSize.height / 8));
-    }];
-    [_imageViewController.imagePreview.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
-        make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
-        make.width.equalTo(@(_imageSize.width / 8));
-        make.height.equalTo(@(_imageSize.height / 8));
-    }];
-}
-
 #pragma mark - Accessors
 
 - (NSArray *)dataArray {
@@ -239,7 +154,7 @@
 
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
     if (editingStyle == UITableViewCellEditingStyleDelete) {
-        [self.delegate deleteTextModel:self.dataArray[indexPath.row]];
+        [self.delegate PDFViewPerformDeleteWatermark:self.dataArray[indexPath.row]];
         [self.dataArray removeObjectAtIndex:indexPath.row];
         
         [tableView beginUpdates];
@@ -254,7 +169,7 @@
     [_dataArray insertObject:dataWater atIndex:destinationIndexPath.row];
 }
 
-#pragma mark - Actons
+#pragma mark - Actions
 
 - (void)onClickedDoneBtn {
     
@@ -263,11 +178,11 @@
     if (_segmentedControl.selectedSegmentIndex == 0) {
     
         _dataModel = self.textViewController.dataModel;
-        [self.delegate changeTextModel:self.dataModel];
+        [self.delegate PDFViewPerformChangeTextWatermark:self.dataModel];
     } else {
         
         _dataModel = self.imageViewController.dataModel;
-        [self.delegate changeImageModel:self.dataModel];
+        [self.delegate PDFViewPerformChangeImageWatermark:self.dataModel];
     }
     
     [self.navigationController popViewControllerAnimated:YES];
@@ -317,62 +232,101 @@
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) {
         
-        [_segmentedControl mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.view.mas_top).offset(43.6);
-            make.width.equalTo(self.view.mas_width);
-            make.height.equalTo(@(self.view.bounds.size.height / 24));
-        }];
-        
-        if (_imageSize.width > _imageSize.height) {
-            [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
-                make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
-                make.width.equalTo(@(_imageSize.width / 8));
-                make.height.equalTo(@(_imageSize.height / 8));
-            }];
-            [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
-                make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
-                make.width.equalTo(@(_imageSize.width / 8));
-                make.height.equalTo(@(_imageSize.height / 8));
-            }];
-        } else {
-            [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
-                make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
-                make.width.equalTo(@(_imageSize.width / 10));
-                make.height.equalTo(@(_imageSize.height / 10));
-            }];
-            [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
-                make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
-                make.width.equalTo(@(_imageSize.width / 10));
-                make.height.equalTo(@(_imageSize.height / 10));
-            }];
-        }
+        [self addSideConstraint];
         
     } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
         
-        [_segmentedControl mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.view.mas_top).offset(83.6);
-            make.width.equalTo(self.view.mas_width);
-            make.height.equalTo(@(852 / 20));
-        }];
-        
-        [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
-            make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
-            make.width.equalTo(@(_imageSize.width / 8));
-            make.height.equalTo(@(_imageSize.height / 8));
-        }];
-        [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
-            make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
-            make.width.equalTo(@(_imageSize.width / 8));
-            make.height.equalTo(@(_imageSize.height / 8));
-        }];
+        [self addNormalConstraint];
     }
 }
 
+- (void)addSideConstraint {
+    [_segmentedControl mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(43.6);
+        make.width.equalTo(self.view.mas_width);
+        make.height.mas_equalTo(35);
+    }];
+    
+    [_textViewController.view mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
+        make.width.equalTo(_segmentedControl.mas_width);
+        make.bottom.equalTo(self.view).offset(-34);
+    }];
+    [_imageViewController.view mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
+        make.width.equalTo(_segmentedControl.mas_width);
+        make.bottom.equalTo(self.view).offset(-34);
+    }];
+    
+    [_textViewController.textView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.right.equalTo(self.view.mas_right).offset(-38);
+        make.height.equalTo(@205);
+        make.width.equalTo(@393);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-74);
+    }];
+    [_textViewController.textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.segmentedControl.mas_bottom).offset(0);
+        make.right.equalTo(_textViewController.textView.mas_left).offset(-5);
+        make.left.equalTo(self.view.mas_left).offset(0);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-34);
+    }];
+    
+    [_imageViewController.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.right.equalTo(self.view.mas_right).offset(-38);
+        make.height.equalTo(@205);
+        make.width.equalTo(@393);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-74);
+    }];
+    [_imageViewController.imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.segmentedControl.mas_bottom).offset(0);
+        make.right.equalTo(_imageViewController.imageView.mas_left).offset(-5);
+        make.left.equalTo(self.view.mas_left).offset(0);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-34);
+    }];
+    
+    [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
+        make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
+        make.width.equalTo(@(_imageSize.width / 10));
+        make.height.equalTo(@(_imageSize.height / 10));
+    }];
+    [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
+        make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
+        make.width.equalTo(@(_imageSize.width / 10));
+        make.height.equalTo(@(_imageSize.height / 10));
+    }];
+}
+
+- (void)addNormalConstraint {
+    [_segmentedControl mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(83.6);
+        make.width.equalTo(self.view.mas_width);
+        make.height.mas_equalTo(40);
+    }];
+    
+    [_textViewController.view mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
+        make.width.equalTo(_segmentedControl.mas_width);
+        make.bottom.equalTo(self.view).offset(-34);
+    }];
+    [_imageViewController.view mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_segmentedControl.mas_bottom).offset(0);
+        make.width.equalTo(_segmentedControl.mas_width);
+        make.bottom.equalTo(self.view).offset(-34);
+    }];
+    [_textViewController.textPreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.equalTo(_textViewController.textPreview.mas_centerX);
+        make.centerY.equalTo(_textViewController.textPreview.mas_centerY);
+        make.width.equalTo(@(_imageSize.width / 8));
+        make.height.equalTo(@(_imageSize.height / 8));
+    }];
+    [_imageViewController.imagePreview.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.equalTo(_imageViewController.imagePreview.mas_centerX);
+        make.centerY.equalTo(_imageViewController.imagePreview.mas_centerY);
+        make.width.equalTo(@(_imageSize.width / 8));
+        make.height.equalTo(@(_imageSize.height / 8));
+    }];
+}
 
 @end

+ 4 - 5
PDFViewer/Controller/CPDFBackgroundSettingViewController.h

@@ -7,21 +7,20 @@
 
 #import <UIKit/UIKit.h>
 #import <ComPDFKit/ComPDFKit.h>
-#import "CPDFBackgroundModel.h"
+#import "PDFBackgroundModel.h"
 
 
 NS_ASSUME_NONNULL_BEGIN
 
 @protocol BackgroundDataModelDelegate <NSObject>
 
-- (void)changeBackgroundModel:(CPDFBackgroundModel *)dataModel;
-- (void)deleteBackgroundModel;
+- (void)PDFViewPerformChangeBackground:(PDFBackgroundModel *)dataModel;
+- (void)PDFViewPerformDeleteBackground;
 
 @end
 
-@interface CPDFBackgroundSettingViewController : UIViewController
+@interface PDFBackgroundSettingViewController : UIViewController
 
-@property (nonatomic,strong) CPDFDocument *document;
 @property (nonatomic,strong) id<BackgroundDataModelDelegate> delegate;
 
 - (instancetype)initWithDocument:(CPDFDocument *)document;

+ 104 - 137
PDFViewer/Controller/CPDFBackgroundSettingViewController.m

@@ -5,35 +5,38 @@
 //  Created by kdanmobile_2 on 2023/1/2.
 //
 
-#import "CPDFBackgroundSettingViewController.h"
-#import "CPDFBackgroundView.h"
-#import "CPDFBackgroundPreview.h"
-#import "CPDFBackgroundSettingView.h"
-#import "CPDFDrawBackgroundView.h"
-#import "CPDFDrawImageView.h"
+#import "PDFBackgroundSettingViewController.h"
+#import "PDFBackgroundView.h"
+#import "PDFBackgroundPreview.h"
+#import "PDFBackgroundSettingView.h"
+#import "PDFDrawBackgroundView.h"
+#import "PDFDrawImageView.h"
 #import "Masonry.h"
 
-@interface CPDFBackgroundSettingViewController () <UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate>
+@interface PDFBackgroundSettingViewController () <UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate>
 
-@property (nonatomic,strong) CPDFBackgroundView *backgroundView;
-@property (nonatomic,strong) CPDFBackgroundPreview *backgroundPreView;
-@property (nonatomic,strong) CPDFBackgroundSettingView *backgroudSettingView;
-@property (nonatomic,strong) CPDFDrawImageView *drawImageView;
-@property (nonatomic,strong) CPDFDrawBackgroundView *drawBackgroundView;
-@property (nonatomic,strong) CPDFBackgroundModel *dataModel;
+@property (nonatomic,strong) PDFBackgroundView *backgroundView;
+@property (nonatomic,strong) PDFBackgroundPreview *backgroundPreView;
+@property (nonatomic,strong) PDFBackgroundSettingView *backgroudSettingView;
+@property (nonatomic,strong) PDFDrawImageView *drawImageView;
+@property (nonatomic,strong) PDFDrawBackgroundView *drawBackgroundView;
+@property (nonatomic,strong) PDFBackgroundModel *dataModel;
 @property (nonatomic,assign) CGSize imageSize;
 @property (nonatomic,strong) UIImage *image;
+@property (nonatomic,strong) CPDFDocument *document;
 
 @end
 
-@implementation CPDFBackgroundSettingViewController
+@implementation PDFBackgroundSettingViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
     
     UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(onClickedDoneBtn)];
     
-    UIBarButtonItem *editBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editClick)];
+    UIBarButtonItem *editBtn = [[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UIBarButtonItemStylePlain target:self action:@selector(editClick)];
     
     UIBarButtonItem *deleteBtn = [[UIBarButtonItem alloc] initWithTitle:@"Delete" style:UIBarButtonItemStylePlain target:self action:@selector(deleteClick)];
     
@@ -61,100 +64,42 @@
 }
 
 - (void)createView {
-    _backgroundView = [[CPDFBackgroundView alloc] init];
+    _backgroundView = [[PDFBackgroundView alloc] init];
     [self.view addSubview:_backgroundView];
     
-    _backgroundPreView = [[CPDFBackgroundPreview alloc] init];
+    _backgroundPreView = [[PDFBackgroundPreview alloc] init];
     [self.view addSubview:_backgroundPreView];
     
     _backgroundPreView.documentView.image = self.image;
     
-    _drawBackgroundView = [[CPDFDrawBackgroundView alloc] initWithFrame:CGRectMake(0, 40, 393, 598.333)];
+    _drawBackgroundView = [[PDFDrawBackgroundView alloc] init];
     _drawBackgroundView.dataModel = self.dataModel;
     [self.backgroundPreView addSubview:_drawBackgroundView];
     
-    _drawImageView      = [[CPDFDrawImageView alloc] initWithFrame:CGRectMake(0, 40, 393, 598.333)];
+    _drawImageView      = [[PDFDrawImageView alloc] init];
     [_drawImageView setImage:_image];
     [self.backgroundPreView addSubview:_drawImageView];
 }
 
 - (void)initDataMoel {
-    _dataModel = [[CPDFBackgroundModel alloc] init];
+    _dataModel = [[PDFBackgroundModel alloc] init];
     _dataModel.backgroundColor = [UIColor whiteColor];
     _dataModel.backgroudScale = 1.0f;
     _dataModel.backgroundOpacity = 1.0f;
     _dataModel.backgroundRotation = 0.0f;
     _dataModel.verticalSpacing = 0.0f;
     _dataModel.horizontalSpacing = 0.0f;
+    _dataModel.pageString = @"0";
 }
 
 - (void)addConstraint {
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown || (self.view.frame.size.width > self.view.frame.size.height)) {
         [self addSideConstraint];
     } else {
-        [self addNomalConstraint];
+        [self addNormalConstraint];
     }
 }
 
-- (void)addSideConstraint {
-    [_backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.equalTo(self.view.mas_bottom).offset(-25);
-        make.left.equalTo(self.view.mas_left);
-        make.right.equalTo(self.view.mas_right);
-        make.height.mas_equalTo(70);
-    }];
-    
-    [_backgroundPreView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_top).offset(43.6);
-        make.left.equalTo(self.view.mas_left);
-        make.right.equalTo(self.view.mas_right);
-        make.bottom.equalTo(self.backgroundView.mas_top);
-    }];
-    
-    [_backgroundPreView.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_top).offset(43.6);
-        make.bottom.equalTo(self.backgroundPreView.mas_bottom);
-        make.centerX.equalTo(self.backgroundPreView.mas_centerX);
-        make.width.mas_equalTo(233);
-    }];
-    
-    [_drawBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
-        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
-        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
-        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
-    }];
-    [_drawImageView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
-        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
-        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
-        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
-    }];
-}
-
-- (void)addNomalConstraint {
-    [_backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.equalTo(self.view.mas_bottom).offset(-25);
-        make.left.equalTo(self.view.mas_left);
-        make.right.equalTo(self.view.mas_right);
-        make.height.mas_equalTo(70);
-    }];
-    
-    [_backgroundPreView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.view.mas_top).offset(83.6);
-        make.left.equalTo(self.view.mas_left);
-        make.right.equalTo(self.view.mas_right);
-        make.bottom.equalTo(self.backgroundView.mas_top);
-    }];
-    
-    [_backgroundPreView.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(self.backgroundPreView.mas_left);
-        make.top.equalTo(self.backgroundPreView.mas_top).offset(40);
-        make.bottom.equalTo(self.backgroundPreView.mas_bottom).offset(-40);
-        make.width.mas_equalTo(393);
-    }];
-}
-
 - (void)addTargets {
     [_backgroundView.selectBtn addTarget:self action:@selector(onSelectBtnClicked:) forControlEvents:UIControlEventTouchDown];
     
@@ -166,7 +111,7 @@
 #pragma mark - Actions
 
 - (void)onClickedDoneBtn {
-    [self.delegate changeBackgroundModel:self.dataModel];
+    [self.delegate PDFViewPerformChangeBackground:self.dataModel];
     
     [self.navigationController popViewControllerAnimated:YES];
 }
@@ -177,7 +122,7 @@
     self.navigationItem.rightBarButtonItems.lastObject.enabled = NO;
     
     if (!([_backgroudSettingView isDescendantOfView:self.view])) {
-        _backgroudSettingView = [[CPDFBackgroundSettingView alloc] init];
+        _backgroudSettingView = [[PDFBackgroundSettingView alloc] init];
         
         _backgroudSettingView.verticalField.delegate = self;
         _backgroudSettingView.horizontalField.delegate = self;
@@ -209,7 +154,7 @@
 }
 
 - (void)deleteClick {
-    [self.delegate deleteBackgroundModel];
+    [self.delegate PDFViewPerformDeleteBackground];
     
     [self.navigationController popViewControllerAnimated:YES];
 }
@@ -245,6 +190,7 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     UIAlertAction *defaultRange = [UIAlertAction actionWithTitle:@"All Pages" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         self.backgroudSettingView.rangeLabel.text = @"Page Range: ALL";
+        self.dataModel.pageString = [NSString stringWithFormat:@"0-%lu",self.document.pageCount - 1];
         }];
     UIAlertAction *customRange = [UIAlertAction actionWithTitle:@"Custom" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         [self createCustomRangeAlert];
@@ -319,66 +265,87 @@
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) {
         
-        [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.bottom.equalTo(self.view.mas_bottom).offset(-25);
-            make.left.equalTo(self.view.mas_left);
-            make.right.equalTo(self.view.mas_right);
-            make.height.mas_equalTo(70);
-        }];
-        
-        [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.view.mas_top).offset(43.6);
-            make.left.equalTo(self.view.mas_left);
-            make.right.equalTo(self.view.mas_right);
-            make.bottom.equalTo(self.backgroundView.mas_top);
-        }];
-        
-        [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.backgroundPreView.mas_top);
-            make.bottom.equalTo(self.backgroundPreView.mas_bottom);
-            make.centerX.equalTo(self.backgroundPreView.mas_centerX);
-            make.width.mas_equalTo(233);
-        }];
-        
-        [_drawBackgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.backgroundPreView.documentView.mas_top);
-            make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
-            make.left.equalTo(self.backgroundPreView.documentView.mas_left);
-            make.right.equalTo(self.backgroundPreView.documentView.mas_right);
-        }];
-        [_drawImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.backgroundPreView.documentView.mas_top);
-            make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
-            make.left.equalTo(self.backgroundPreView.documentView.mas_left);
-            make.right.equalTo(self.backgroundPreView.documentView.mas_right);
-        }];
+        [self addSideConstraint];
     } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
         
-        [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.bottom.equalTo(self.view.mas_bottom).offset(-25);
-            make.left.equalTo(self.view.mas_left);
-            make.right.equalTo(self.view.mas_right);
-            make.height.mas_equalTo(70);
-        }];
-        
-        [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(self.view.mas_top).offset(83.6);
-            make.left.equalTo(self.view.mas_left);
-            make.right.equalTo(self.view.mas_right);
-            make.bottom.equalTo(self.backgroundView.mas_top);
-        }];
-        
-        [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.left.equalTo(self.view.mas_left);
-            make.top.equalTo(self.view.mas_top).offset(123.6);
-            make.bottom.equalTo(self.backgroundPreView.mas_bottom).offset(-40);
-            make.width.mas_equalTo(393);
-        }];
+        [self addNormalConstraint];
     }
     
     [_drawBackgroundView setNeedsDisplay];
 }
 
+- (void)addSideConstraint {
+    [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.bottom.equalTo(self.view.mas_bottom).offset(-25);
+        make.left.equalTo(self.view.mas_left);
+        make.right.equalTo(self.view.mas_right);
+        make.height.mas_equalTo(70);
+    }];
+    
+    [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(43.6);
+        make.left.equalTo(self.view.mas_left);
+        make.right.equalTo(self.view.mas_right);
+        make.bottom.equalTo(self.backgroundView.mas_top);
+    }];
+    
+    [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(43.6);
+        make.bottom.equalTo(self.backgroundPreView.mas_bottom);
+        make.centerX.equalTo(self.backgroundPreView.mas_centerX);
+        make.width.mas_equalTo(233);
+    }];
+    
+    [_drawBackgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
+        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
+        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
+        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
+    }];
+    [_drawImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
+        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
+        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
+        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
+    }];
+}
+
+- (void)addNormalConstraint {
+    [_backgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.bottom.equalTo(self.view.mas_bottom).offset(-25);
+        make.left.equalTo(self.view.mas_left);
+        make.right.equalTo(self.view.mas_right);
+        make.height.mas_equalTo(70);
+    }];
+    
+    [_backgroundPreView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(83.6);
+        make.left.equalTo(self.view.mas_left);
+        make.right.equalTo(self.view.mas_right);
+        make.bottom.equalTo(self.backgroundView.mas_top);
+    }];
+    
+    [_backgroundPreView.documentView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.equalTo(self.backgroundPreView.mas_left);
+        make.top.equalTo(self.backgroundPreView.mas_top).offset(40);
+        make.bottom.equalTo(self.backgroundPreView.mas_bottom).offset(-40);
+        make.width.mas_equalTo(393);
+    }];
+    
+    [_drawBackgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
+        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
+        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
+        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
+    }];
+    [_drawImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.backgroundPreView.documentView.mas_top);
+        make.bottom.equalTo(self.backgroundPreView.documentView.mas_bottom);
+        make.left.equalTo(self.backgroundPreView.documentView.mas_left);
+        make.right.equalTo(self.backgroundPreView.documentView.mas_right);
+    }];
+}
+
 #pragma mark - UIImagePickerControllerDelegate
 
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey,id> *)info {
@@ -387,7 +354,7 @@
     size.width = self.backgroundPreView.documentView.frame.size.width;
     size.height = self.backgroundPreView.documentView.frame.size.height;
     _dataModel.image = [self imageWithImageSimple:image scaledToSize:_imageSize];
-    [_backgroundPreView.imageView sizeToFit];
+    [_backgroundPreView.preImageView sizeToFit];
     
     [picker dismissViewControllerAnimated:YES completion:nil];
     [_drawBackgroundView setNeedsDisplay];

+ 24 - 0
PDFViewer/Controller/PDFImageViewController.h

@@ -0,0 +1,24 @@
+//
+//  CPDFImageViewController.h
+//  PDFViewer
+//
+//  Created by kdan on 2022/11/19.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFImageView.h"
+#import "PDFImagePreview.h"
+#import "PDFWatermarkViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFImageViewController : PDFWatermarkViewController
+
+@property (nonatomic,strong) PDFImagePreview *imagePreview;
+@property (nonatomic,strong) PDFImageView *imageView;
+
+- (UIImage *)imageWithImageSimple:(UIImage *)image scaledToSize:(CGSize)newSize;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 116 - 165
PDFViewer/Controller/CPDFImageViewController.m

@@ -5,20 +5,21 @@
 //  Created by kdan on 2022/11/19.
 //
 
-#import "CPDFImageViewController.h"
-#import "CPDFImageView.h"
-#import "CPDFImagePreview.h"
-#import "CPDFDataModel.h"
-#import "CPDFDrawView.h"
-#import "CPDFClipView.h"
+#import "PDFImageViewController.h"
+#import "PDFImageView.h"
+#import "PDFImagePreview.h"
+#import "PDFDataModel.h"
+#import "PDFDrawView.h"
+#import "PDFClipView.h"
+#import "PDFWatermarkControllerHeader.h"
 #import "Masonry.h"
 
-@interface CPDFImageViewController () <UIImagePickerControllerDelegate,UINavigationControllerDelegate,CPDFClipTextPreviewDelegate,UITextFieldDelegate>
+@interface PDFImageViewController () <UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate>
 
 @property (nonatomic,assign) CGRect watermarkFrame;
 
-@property (nonatomic,strong) CPDFDrawView *drawView;
-@property (nonatomic,strong) CPDFClipView *cliView;
+@property (nonatomic,strong) PDFDrawView *drawView;
+@property (nonatomic,strong) PDFClipView *cliView;
 @property (nonatomic,assign) CGAffineTransform transform1;
 @property (nonatomic,assign) CGAffineTransform transform2;
 @property (nonatomic,assign) CGRect normalWatermarkRect;
@@ -26,14 +27,15 @@
 
 @end
 
-@implementation CPDFImageViewController
+@implementation PDFImageViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    _imagePreview = [[CPDFImagePreview alloc] init];
-    _imageView = [[CPDFImageView alloc] init];
-    _dataModel = [[CPDFDataModel alloc] init];
+    _imagePreview = [[PDFImagePreview alloc] init];
+    _imageView = [[PDFImageView alloc] init];
     
     _imageView.verticalField.delegate = self;
     _imageView.horizontalField.delegate = self;
@@ -42,7 +44,7 @@
     [self.view addSubview:_imageView];
     [self.view setBackgroundColor:UIColor.systemGray5Color];
     
-    [self initDataModel];
+    [self initWatermarkView];
     [self addConstraint];
     [self addTargets];
     [self createGestureRecognizer];
@@ -53,92 +55,101 @@
 
 #pragma mark - Orientation
 
+- (void)initDataModel {
+    self.dataModel.textColor = UIColor.blackColor;
+    self.dataModel.watermarkOpacity = 1;
+    self.dataModel.watermarkScale = 17.0 / 24.0;
+    self.dataModel.isTile = NO;
+    self.dataModel.watermarkRotation = 0;
+    self.dataModel.verticalSpacing = 100;
+    self.dataModel.horizontalSpacing = 100;
+    self.dataModel.imagePath = @"btn_selected";
+    self.dataModel.image = [UIImage imageNamed:self.dataModel.imagePath];
+}
+
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) {
-        
-        [_imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.right.equalTo(self.view.mas_right).offset(-38);
-            make.left.equalTo(_imagePreview.mas_right).offset(0);
-            make.height.equalTo(@205);
-            make.width.equalTo(@(self.view.bounds.size.width));
-            make.bottom.equalTo(self.view.mas_bottom).offset(-40);
+        [self addSideConstraints];
+    } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
+        [self addNormalConstraints];
+    }
+    
+    if ([_drawView isDescendantOfView:self.view]) {
+        _imageView.tileSwitch.on = NO;
+        [_cliView removeFromSuperview];
+        [_drawView removeFromSuperview];
+    }
+}
+
+- (void)addSideConstraints {
+    [_imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.right.equalTo(self.view.mas_right).offset(-38);
+        make.left.equalTo(_imagePreview.mas_right).offset(0);
+        make.height.equalTo(@205);
+        make.width.equalTo(@(self.view.bounds.size.width));
+        make.bottom.equalTo(self.view.mas_bottom).offset(-40);
+    }];
+    [_imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(0);
+        make.right.equalTo(_imageView.mas_left).offset(-5);
+        make.left.equalTo(self.view.mas_left).offset(0);
+        make.bottom.equalTo(self.view.mas_bottom).offset(0);
+    }];
+
+    if ([_drawView isDescendantOfView:self.view]) {
+        [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(self.view.mas_top).offset(0);
+            make.right.equalTo(_imageView.mas_left).offset(-5);
+            make.left.equalTo(self.view.mas_left).offset(0);
+            make.bottom.equalTo(self.view.mas_bottom).offset(0);
         }];
-        [_imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.view.mas_top).offset(0);
             make.right.equalTo(_imageView.mas_left).offset(-5);
             make.left.equalTo(self.view.mas_left).offset(0);
             make.bottom.equalTo(self.view.mas_bottom).offset(0);
         }];
+    }
+}
+
+- (void)addNormalConstraints {
+    [_imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(0);
+        make.width.equalTo(self.view.mas_width);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-205);
+    }];
+
+    [_imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_imagePreview.mas_bottom).offset(0);
+        make.width.equalTo(_imagePreview.mas_width);
+        make.bottom.equalTo(self.view.mas_bottom).offset(0);
+    }];
     
-        if ([_drawView isDescendantOfView:self.view]) {
-            [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.right.equalTo(_imageView.mas_left).offset(-5);
-                make.left.equalTo(self.view.mas_left).offset(0);
-                make.bottom.equalTo(self.view.mas_bottom).offset(0);
-            }];
-            [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.right.equalTo(_imageView.mas_left).offset(-5);
-                make.left.equalTo(self.view.mas_left).offset(0);
-                make.bottom.equalTo(self.view.mas_bottom).offset(0);
-            }];
-        }
-    } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
-        [_imagePreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+    if ([_drawView isDescendantOfView:self.view]) {
+        [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.view.mas_top).offset(0);
             make.width.equalTo(self.view.mas_width);
             make.bottom.equalTo(self.view.mas_bottom).offset(-205);
         }];
-
-        [_imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(_imagePreview.mas_bottom).offset(0);
-            make.width.equalTo(_imagePreview.mas_width);
-            make.bottom.equalTo(self.view.mas_bottom).offset(0);
+        [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(self.view.mas_top).offset(0);
+            make.width.equalTo(self.view.mas_width);
+            make.bottom.equalTo(self.view.mas_bottom).offset(-205);
         }];
-        
-        if ([_drawView isDescendantOfView:self.view]) {
-            [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.width.equalTo(self.view.mas_width);
-                make.bottom.equalTo(self.view.mas_bottom).offset(-205);
-            }];
-            [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.width.equalTo(self.view.mas_width);
-                make.bottom.equalTo(self.view.mas_bottom).offset(-205);
-            }];
-        }
-    }
-    
-    if ([_drawView isDescendantOfView:self.view]) {
-        [_drawView setDocumentViewRect:_imagePreview.documentView.frame];
-        [_drawView setWaterLabelRect:_imagePreview.watermarkView.frame];
-        [_drawView setNeedsDisplay];
-        [_cliView setNeedsDisplay];
     }
 }
 
 #pragma mark - Initializers
 
-- (void)initDataModel {
-    _dataModel.watermarkOpacity = 1;
-    _dataModel.imagePath = @"btn_selected";
-    _dataModel.image = [UIImage imageNamed:_dataModel.imagePath];
-    _dataModel.watermarkScale = 1;
-    _dataModel.isTile = NO;
-    _dataModel.watermarkRotation = 0;
-    _dataModel.horizontalSpacing = 100;
-    _dataModel.verticalSpacing = 100;
-    
+- (void)initWatermarkView {
     _imageView.horizontalField.text = 0;
     _imageView.verticalField.text = 0;
     _imageView.horizontalField.enabled = NO;
     _imageView.verticalField.enabled = NO;
     _imageView.imageScaleSlider.enabled = YES;
-    _imagePreview.watermarkView.image = [UIImage imageNamed:_dataModel.imagePath];
+    _imagePreview.preImageView.image = [UIImage imageNamed:self.dataModel.imagePath];
 }
 
 - (void)addConstraint {
@@ -170,12 +181,12 @@
 
 - (void)createGestureRecognizer {
     [_imagePreview.documentView setUserInteractionEnabled:YES];
-    [_imagePreview.watermarkView setMultipleTouchEnabled:YES];
-    [_imagePreview.watermarkView setUserInteractionEnabled:YES];
+    [_imagePreview.preImageView setMultipleTouchEnabled:YES];
+    [_imagePreview.preImageView setUserInteractionEnabled:YES];
     [_imagePreview.rotationBtn setUserInteractionEnabled:YES];
     
     UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panWatermarkView:)];
-    [_imagePreview.watermarkView addGestureRecognizer:panRecognizer];
+    [_imagePreview.preImageView addGestureRecognizer:panRecognizer];
     
     UIPanGestureRecognizer *panRotationBtnRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(rotateWatermarkView:)];
     [_imagePreview.rotationBtn addGestureRecognizer:panRotationBtnRecognizer];
@@ -183,16 +194,16 @@
 
 - (void)rotateWatermarkView:(UIPanGestureRecognizer *)recognizer {
     CGPoint point = [recognizer translationInView:_imagePreview];
-    CGFloat radian = atan2(point.x + _imagePreview.center.x - _imagePreview.watermarkView.center.x,point.y + _imagePreview.center.y - _imagePreview.watermarkView.center.y);
+    CGFloat radian = atan2(point.x + _imagePreview.center.x - _imagePreview.preImageView.center.x,point.y + _imagePreview.center.y - _imagePreview.preImageView.center.y);
     
     if (self.dataModel.watermarkScale == 1) {
-        _imagePreview.watermarkView.transform = CGAffineTransformMakeRotation(-radian);
+        _imagePreview.preImageView.transform = CGAffineTransformMakeRotation(-radian);
     } else {
-        _imagePreview.watermarkView.transform = CGAffineTransformRotate(self.transform2, -radian);
+        _imagePreview.preImageView.transform = CGAffineTransformRotate(self.transform2, -radian);
     }
     
     _transform1 = CGAffineTransformMakeRotation(-radian);
-    _dataModel.watermarkRotation = (-radian) * 180 / M_PI;
+    self.dataModel.watermarkRotation = (-radian) * 180 / M_PI;
 }
 
 - (void)panWatermarkView:(UIPanGestureRecognizer *)recognizer {
@@ -201,18 +212,18 @@
     documentFrame.origin.x -= _imagePreview.documentView.frame.origin.x;
     documentFrame.origin.y -= _imagePreview.documentView.frame.origin.y;
     
-    [_imagePreview.watermarkView setCenter:CGPointMake(_imagePreview.watermarkView.center.x + point.x, _imagePreview.watermarkView.center.y + point.y)];
+    [_imagePreview.preImageView setCenter:CGPointMake(_imagePreview.preImageView.center.x + point.x, _imagePreview.preImageView.center.y + point.y)];
     [_imagePreview.rotationBtn setCenter:CGPointMake(_imagePreview.rotationBtn.center.x + point.x, _imagePreview.rotationBtn.center.y + point.y)];
     
-    if (!CGRectContainsRect(documentFrame,_imagePreview.watermarkView.frame)) {
-        [_imagePreview.watermarkView setCenter:CGPointMake(_imagePreview.watermarkView.center.x - point.x, _imagePreview.watermarkView.center.y - point.y)];
+    if (!CGRectContainsRect(documentFrame,_imagePreview.preImageView.frame)) {
+        [_imagePreview.preImageView setCenter:CGPointMake(_imagePreview.preImageView.center.x - point.x, _imagePreview.preImageView.center.y - point.y)];
         [_imagePreview.rotationBtn setCenter:CGPointMake(_imagePreview.rotationBtn.center.x - point.x, _imagePreview.rotationBtn.center.y - point.y)];
     }
     
-    _dataModel.tx = _imagePreview.watermarkView.center.x - (_imagePreview.documentView.center.x - _imagePreview.documentView.frame.origin.x);
-    _dataModel.ty = _imagePreview.documentView.center.y - _imagePreview.documentView.frame.origin.y - _imagePreview.watermarkView.center.y;
+    self.dataModel.tx = _imagePreview.preImageView.center.x - (_imagePreview.documentView.center.x - _imagePreview.documentView.frame.origin.x);
+    self.dataModel.ty = _imagePreview.documentView.center.y - _imagePreview.documentView.frame.origin.y - _imagePreview.preImageView.center.y;
     
-    _shadowWaterLabel.center = _imagePreview.watermarkView.center;
+    _shadowWaterLabel.center = _imagePreview.preImageView.center;
     
     [recognizer setTranslation:CGPointZero inView:_imagePreview.documentView];
     
@@ -230,8 +241,8 @@
 }
 
 - (void)onOpacityChanged:(UISlider *)sender {
-    _imagePreview.watermarkView.alpha =  1 - sender.value;
-    [_dataModel setWatermarkOpacity:1 - sender.value];
+    _imagePreview.preImageView.alpha =  1 - sender.value;
+    [self.dataModel setWatermarkOpacity:1 - sender.value];
 }
 
 /*
@@ -252,67 +263,34 @@
     sender.maximumValue = 2;
     
     if (self.dataModel.watermarkRotation) {
-        _imagePreview.watermarkView.transform = CGAffineTransformScale(self.transform1, sender.value, sender.value);
+        _imagePreview.preImageView.transform = CGAffineTransformScale(self.transform1, sender.value, sender.value);
     } else {
-            _imagePreview.watermarkView.transform = CGAffineTransformMakeScale(sender.value, sender.value);
+            _imagePreview.preImageView.transform = CGAffineTransformMakeScale(sender.value, sender.value);
     }
 
     _transform2 = CGAffineTransformMakeScale(sender.value, sender.value);
     _shadowWaterLabel.transform = CGAffineTransformMakeScale(sender.value, sender.value);
     
     [_imagePreview.rotationBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_imagePreview.watermarkView.mas_bottom).offset(-10);
+        make.top.equalTo(_imagePreview.preImageView.mas_bottom).offset(-10);
         make.width.equalTo(@20);
         make.height.equalTo(@20);
-        make.left.equalTo(_imagePreview.watermarkView.mas_right).offset(-10);
+        make.left.equalTo(_imagePreview.preImageView.mas_right).offset(-10);
     }];
     
-    [_dataModel setWatermarkScale:sender.value];
+    [self.dataModel setWatermarkScale:sender.value];
     
     _normalWatermarkRect = _shadowWaterLabel.frame;
 }
 
-- (void)onSelectPageRange:(UIButton *)sender {
-    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-    UIAlertAction *defaultRange = [UIAlertAction actionWithTitle:@"All Pages" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        self.imageView.rangeLabel.text = @"Page Range: ALL";
-        }];
-    UIAlertAction *customRange = [UIAlertAction actionWithTitle:@"Custom Page Range" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [self createCustomRangeAlert];
-        }];
-    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-            
-        }];
-    [alertController addAction:defaultRange];
-    [alertController addAction:customRange];
-    [alertController addAction:cancelAction];
-    [self presentViewController:alertController animated:YES completion:nil];
-}
-
-- (void)createCustomRangeAlert {
-    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Custom Page Range" message:nil preferredStyle:UIAlertControllerStyleAlert];
-    
-    [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
-        textField.placeholder = @"such as:1,3-5,10";
-    }];
-    [alertController addAction:[UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        
-        self.dataModel.pageString = alertController.textFields.firstObject.text;
-        self.imageView.rangeLabel.text = @"Page Range:Custom";
-    }]];
-    [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-    }]];
-    [self presentViewController:alertController animated:YES completion:nil];
-}
-
 - (void)onTileSwitchChanged:(UISwitch *) sender {
     if ([sender isOn]) {
-        _dataModel.isTile = YES;
+        self.dataModel.isTile = YES;
         _imageView.horizontalField.enabled = YES;
         _imageView.verticalField.enabled = YES;
         _imageView.imageScaleSlider.enabled = NO;
         
-        _drawView = [[CPDFDrawView alloc] initWithFrame:self.imagePreview.bounds];
+        _drawView = [[PDFDrawView alloc] initWithFrame:self.imagePreview.bounds];
         
         [_drawView setDataModel:self.dataModel];
         [_drawView setWaterLabelRect:self.normalWatermarkRect];
@@ -321,13 +299,13 @@
         [self.view addSubview:_drawView];
         [self.imagePreview bringSubviewToFront:_drawView];
         
-        _cliView = [[CPDFClipView alloc] initWithFrame:self.imagePreview.bounds];
-        _cliView.delegate = self;
+        _cliView = [[PDFClipView alloc] initWithFrame:self.imagePreview.bounds];
+        [_cliView setDocumentRect:self.imagePreview.documentView.frame];
         [self.view addSubview:_cliView];
         [self.drawView bringSubviewToFront:_cliView];
         
     } else {
-        _dataModel.isTile = NO;
+        self.dataModel.isTile = NO;
         _imageView.horizontalField.enabled = NO;
         _imageView.verticalField.enabled = NO;
         _imageView.imageScaleSlider.enabled = YES;
@@ -339,14 +317,14 @@
 
 - (void)horizontalChange:(UITextField *)text {
     [_drawView setHorizontal:[text.text floatValue]];
-    _dataModel.horizontalSpacing = [text.text floatValue];
+    self.dataModel.horizontalSpacing = [text.text floatValue];
     
     [_drawView setNeedsDisplay];
 }
 
 - (void)verticalChage:(UITextField *)text {
     [_drawView setVertical:[text.text floatValue]];
-    _dataModel.verticalSpacing = [text.text floatValue];
+    self.dataModel.verticalSpacing = [text.text floatValue];
     
     [_drawView setNeedsDisplay];
 }
@@ -359,10 +337,10 @@
     CGSize size;
     size.width = image.size.width / 30;
     size.height = image.size.height / 30;
-    _imagePreview.watermarkView.image = [self imageWithImageSimple:image scaledToSize:size];
-    _dataModel.image = [self imageWithImageSimple:image scaledToSize:size];
-    [_imagePreview.watermarkView sizeToFit];
-    _shadowWaterLabel.frame = _imagePreview.watermarkView.frame;
+    _imagePreview.preImageView.image = [self imageWithImageSimple:image scaledToSize:size];
+    self.dataModel.image = [self imageWithImageSimple:image scaledToSize:size];
+    [_imagePreview.preImageView sizeToFit];
+    _shadowWaterLabel.frame = _imagePreview.preImageView.frame;
     [picker dismissViewControllerAnimated:YES completion:nil];
     _normalWatermarkRect = _shadowWaterLabel.frame;
 }
@@ -380,14 +358,6 @@
     return newImage;
 }
 
-#pragma mark - CPDFClipTextPreviewDelegate
-
-- (void)clipText:(CGContextRef)context {
-    CGContextSetFillColorWithColor(context, [UIColor systemGray5Color].CGColor);
-    CGContextFillRect(context, self.imagePreview.bounds);
-    CGContextClearRect(context, self.imagePreview.documentView.frame);
-}
-
 #pragma mark - UITextFieldDelegate
 
 - (void)textFieldDidBeginEditing:(UITextField *)textField {
@@ -442,23 +412,4 @@
     return YES;
 }
 
-- (BOOL)validateValue:(NSString *)number {
-    BOOL res = YES;
-    NSCharacterSet *numberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
-    
-    NSInteger i = 0;
-    while (i < number.length) {
-        NSString *str = [number substringWithRange:NSMakeRange(i, 1)];
-        NSRange range = [str rangeOfCharacterFromSet:numberSet];
-        
-        if (range.length == 0) {
-            res = NO;
-            break;
-        }
-        i++;
-    }
-    
-    return  res;
-}
-
 @end

+ 3 - 3
PDFViewer/Controller/CPDFListController.h

@@ -8,15 +8,15 @@
 #import <UIKit/UIKit.h>
 
 
-@class CPDFModel;
+@class PDFModel;
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFListController : UIViewController
+@interface PDFListController : UIViewController
 
 @property (nonatomic,copy) NSString *path;
 
-- (instancetype)initWithModel:(CPDFModel *)model;
+- (instancetype)initWithModel:(PDFModel *)model;
 
 @end
 

+ 16 - 10
PDFViewer/Controller/CPDFListController.m

@@ -6,29 +6,33 @@
 //
 
 #import <ComPDFKit/ComPDFKit.h>
-#import "CPDFListController.h"
-#import "CPDFModel.h"
-#import "CPDFViewController.h"
+#import "PDFListController.h"
+#import "PDFModel.h"
+#import "PDFViewController.h"
 
 extern BOOL gImagePreviewIsFirstLayout;
 extern BOOL gTextPreviewIsFirstLayout;
 
-@interface CPDFListController () <UITableViewDataSource,UITableViewDelegate>
+@interface PDFListController () <UITableViewDataSource,UITableViewDelegate>
 
 @property (nonatomic,strong) UITableView *tableView;
 @property (nonatomic,strong) NSMutableArray *dataArray;
 
 @end
 
-@implementation CPDFListController
+@implementation PDFListController
 
-- (instancetype)initWithModel:(CPDFModel *)model {
+#pragma mark - Initializers
+
+- (instancetype)initWithModel:(PDFModel *)model {
     if (self = [super init]) {
         [self setPath:model.filePath];
     }
     return self;
 }
 
+#pragma mark - Accessors
+
 - (NSArray *)dataArray {
 
     if (!_dataArray) {
@@ -46,7 +50,7 @@ extern BOOL gTextPreviewIsFirstLayout;
             
             NSString *subFilePath = [[self.path stringByAppendingString:@"/"] stringByAppendingString:fileArray[i]];
             
-            CPDFModel *model = [[CPDFModel alloc] init];
+            PDFModel *model = [[PDFModel alloc] init];
             model.fileName = fileArray[i];
             model.filePath = subFilePath;
             
@@ -57,6 +61,8 @@ extern BOOL gTextPreviewIsFirstLayout;
     return _dataArray;
 }
 
+#pragma mark - UIViewController Methods
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     
@@ -109,14 +115,14 @@ extern BOOL gTextPreviewIsFirstLayout;
     [defaultManager fileExistsAtPath:[self.dataArray[indexPath.row] filePath] isDirectory:&isDir];
     
     if (isDir) {
-        CPDFModel *model = [[CPDFModel alloc] init];
+        PDFModel *model = [[PDFModel alloc] init];
         model.filePath = [[self.dataArray[indexPath.row] filePath] stringByAppendingString:@"/"];
-        CPDFListController *pdfListController = [[CPDFListController alloc] initWithModel:model];
+        PDFListController *pdfListController = [[PDFListController alloc] initWithModel:model];
         [self.navigationController pushViewController:pdfListController animated:YES];
         
     } else {
         
-        CPDFViewController *pdfViewcontroller = [[CPDFViewController alloc] initWithPath:[self.dataArray[indexPath.row] filePath]];
+        PDFViewController *pdfViewcontroller = [[PDFViewController alloc] initWithPath:[self.dataArray[indexPath.row] filePath]];
         [self.navigationController pushViewController:pdfViewcontroller animated:YES];
         gImagePreviewIsFirstLayout = YES;
         gTextPreviewIsFirstLayout = YES;

+ 22 - 0
PDFViewer/Controller/PDFTextViewController.h

@@ -0,0 +1,22 @@
+//
+//  CPDFTextViewController.h
+//  PDFViewer
+//
+//  Created by kdan on 2022/11/19.
+//
+
+#import <UIKit/UIKit.h>
+#import "PDFTextView.h"
+#import "PDFTextPreview.h"
+#import "PDFWatermarkViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFTextViewController : PDFWatermarkViewController
+
+@property (nonatomic,strong) PDFTextPreview *textPreview;
+@property (nonatomic,strong) PDFTextView *textView;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 136 - 175
PDFViewer/Controller/CPDFTextViewController.m

@@ -5,35 +5,38 @@
 //  Created by kdan on 2022/11/19.
 //
 
-#import "CPDFTextViewController.h"
-#import "CPDFTextView.h"
-#import "CPDFDataModel.h"
-#import "CPDFDrawView.h"
-#import "CPDFClipView.h"
+#import "PDFTextViewController.h"
+#import "PDFTextView.h"
+#import "PDFDataModel.h"
+#import "PDFDrawView.h"
+#import "PDFClipView.h"
 #import "Masonry.h"
+#import "PDFWatermarkControllerHeader.h"
 
-@interface CPDFTextViewController () <CPDFClipTextPreviewDelegate,UITextFieldDelegate>
+@interface PDFTextViewController () <UITextFieldDelegate>
 
-@property (nonatomic,strong) CPDFDrawView *drawView;
-@property (nonatomic,strong) CPDFClipView *cliView;
+@property (nonatomic,strong) UIAlertController *alertController;
+@property (nonatomic,strong) PDFDrawView *drawView;
+@property (nonatomic,strong) PDFClipView *cliView;
 @property (nonatomic,assign) CGRect normalWatermarkRect;
 @property (nonatomic,strong) UILabel *shadowWaterLabel;
 
 @end
 
-@implementation CPDFTextViewController
+@implementation PDFTextViewController
+
+#pragma mark - UIViewController Methods
 
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     
-    _textPreview = [[CPDFTextPreview alloc] init];
-    _textView = [[CPDFTextView alloc] init];
+    _textPreview = [[PDFTextPreview alloc] init];
+    _textView = [[PDFTextView alloc] init];
     
     _textView.verticalField.delegate = self;
     _textView.horizontalField.delegate = self;
     
-    _dataModel = [[CPDFDataModel alloc] init];
     _alertController = [UIAlertController alertControllerWithTitle:@"Watermark Content" message:nil preferredStyle:UIAlertControllerStyleAlert];
     
     [self.view addSubview:_textPreview];
@@ -41,28 +44,30 @@
     [self.view setBackgroundColor:UIColor.systemGray5Color];
     
     [self addConstraint];
-    [self initDataModel];
+    [self initWatermarkView];
     [self addTargets];
     [self createGestureRecognizer];
     
-    _normalWatermarkRect = CGRectMake(69.666, 147.666, 83.666, 20.333);
-    _shadowWaterLabel = [[UILabel alloc] initWithFrame:CGRectMake(69.666, 147.666, 83.666, 20.333)];
-    _shadowWaterLabel.text = _textPreview.watermarkLabel.text;
+    _normalWatermarkRect = CGRectMake(69.666, 138.333, 88, 20.333);
+    _shadowWaterLabel = [[UILabel alloc] initWithFrame:CGRectMake(69.666, 138.333, 88, 20.333)];
+    _shadowWaterLabel.text = _textPreview.preLabel.text;
 }
 
 #pragma mark - Initializers
 
 - (void)initDataModel {
-    _dataModel.textColor = UIColor.blackColor;
-    _dataModel.watermarkOpacity = 1;
-    _dataModel.text = @"Watermark";
-    _dataModel.watermarkScale = 17.0 / 24.0;
-    _dataModel.isTile = NO;
-    _dataModel.watermarkRotation = 0;
-    _dataModel.verticalSpacing = 100;
-    _dataModel.horizontalSpacing = 100;
-    
-    _textPreview.watermarkLabel.text = _dataModel.text;
+    self.dataModel.textColor = UIColor.blackColor;
+    self.dataModel.watermarkOpacity = 1;
+    self.dataModel.text = @"Watermark";
+    self.dataModel.watermarkScale = 17.0 / 24.0;
+    self.dataModel.isTile = NO;
+    self.dataModel.watermarkRotation = 0;
+    self.dataModel.verticalSpacing = 100;
+    self.dataModel.horizontalSpacing = 100;
+}
+
+- (void)initWatermarkView {
+    _textPreview.preLabel.text = self.dataModel.text;
     _textView.horizontalField.text = 0;
     _textView.verticalField.text = 0;
     _textView.horizontalField.enabled = NO;
@@ -88,15 +93,15 @@
         [_textView.colorArray[i] addTarget:self action:@selector(onColorBtnClicked:) forControlEvents:UIControlEventTouchDown];
     }
     
-    __block CPDFTextViewController *strongBlock = self;
+    __block PDFTextViewController *strongBlock = self;
     [_alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
         
     }];
     [_alertController addAction:[UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         
         strongBlock.dataModel.text = strongBlock.alertController.textFields.firstObject.text;
-        strongBlock.textPreview.watermarkLabel.text = strongBlock.alertController.textFields.firstObject.text;
-        [strongBlock.textPreview.watermarkLabel sizeToFit];
+        strongBlock.textPreview.preLabel.text = strongBlock.alertController.textFields.firstObject.text;
+        [strongBlock.textPreview.preLabel sizeToFit];
         
     }]];
     [_alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
@@ -115,121 +120,89 @@
 #pragma mark - UI Functions
 
 - (void)onColorBtnClicked:(UIButton *)sender {
-    _textPreview.watermarkLabel.textColor = sender.backgroundColor;
-    [_dataModel setTextColor:sender.backgroundColor];
+    _textPreview.preLabel.textColor = sender.backgroundColor;
+    [self.dataModel setTextColor:sender.backgroundColor];
 }
 
 - (void)onOpacityChanged:(UISlider *)sender {
-    _textPreview.watermarkLabel.alpha =  1 - sender.value;
-    [_dataModel setWatermarkOpacity:1 - sender.value];
+    _textPreview.preLabel.alpha =  1 - sender.value;
+    [self.dataModel setWatermarkOpacity:1 - sender.value];
 }
 
 - (void)onTextScaleChanged:(UISlider *)sender {
-    if (!_dataModel.isTile) {
+    if (!self.dataModel.isTile) {
         sender.minimumValue = 12;
         sender.maximumValue = 36;
-        _textPreview.watermarkLabel.font = [_textPreview.watermarkLabel.font fontWithSize:sender.value];
-        _shadowWaterLabel.font = [_textPreview.watermarkLabel.font fontWithSize:sender.value];
-        _shadowWaterLabel.center = _textPreview.watermarkLabel.center;
+        _textPreview.preLabel.font = [_textPreview.preLabel.font fontWithSize:sender.value];
+        self.shadowWaterLabel.font = [_textPreview.preLabel.font fontWithSize:sender.value];
+        self.shadowWaterLabel.center = _textPreview.preLabel.center;
         
-        [_textPreview.watermarkLabel sizeToFit];
-        [_shadowWaterLabel sizeToFit];
+        [_textPreview.preLabel sizeToFit];
+        [self.shadowWaterLabel sizeToFit];
         
-        [_dataModel setWatermarkScale:sender.value / 24];
+        [self.dataModel setWatermarkScale:sender.value / 24];
     }
     
-    _normalWatermarkRect = _shadowWaterLabel.frame;
+    self.normalWatermarkRect = self.shadowWaterLabel.frame;
 }
 
 - (void)onTileSwitchChanged:(UISwitch *) sender {
     if ([sender isOn]) {
-        _dataModel.isTile = YES;
+        self.dataModel.isTile = YES;
         _textView.horizontalField.enabled = YES;
         _textView.verticalField.enabled = YES;
         _textView.textScaleSlider.enabled = NO;
         
-        _drawView = [[CPDFDrawView alloc] initWithFrame:self.textPreview.bounds];
+        self.drawView = [[PDFDrawView alloc] initWithFrame:self.textPreview.bounds];
         
-        [_drawView setDataModel:self.dataModel];
-        [_drawView setWaterLabelRect:self.normalWatermarkRect];
-        [_drawView setDocumentViewRect:self.textPreview.documentView.frame];
+        [self.drawView setDataModel:self.dataModel];
+        [self.drawView setWaterLabelRect:self.normalWatermarkRect];
+        [self.drawView setDocumentViewRect:self.textPreview.documentView.frame];
         
-        [self.view addSubview:_drawView];
-        [self.textPreview bringSubviewToFront:_drawView];
+        [self.view addSubview:self.drawView];
+        [self.textPreview bringSubviewToFront:self.drawView];
         
-        _cliView = [[CPDFClipView alloc] initWithFrame:self.textPreview.bounds];
-        _cliView.delegate = self;
-        [self.view addSubview:_cliView];
-        [self.drawView bringSubviewToFront:_cliView];
+        self.cliView = [[PDFClipView alloc] initWithFrame:self.textPreview.bounds];
+        [self.cliView setDocumentRect:self.textPreview.documentView.frame];
+        [self.view addSubview:self.cliView];
+        [self.drawView bringSubviewToFront:self.cliView];
         
     } else {
-        _dataModel.isTile = NO;
+        self.dataModel.isTile = NO;
         _textView.horizontalField.enabled = NO;
         _textView.verticalField.enabled = NO;
         _textView.textScaleSlider.enabled = YES;
         
-        [_drawView removeFromSuperview];
-        [_cliView removeFromSuperview];
+        [self.drawView removeFromSuperview];
+        [self.cliView removeFromSuperview];
     }
 }
 
-- (void)onSelectPageRange:(UIButton *)sender {
-    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-    UIAlertAction *defaultRange = [UIAlertAction actionWithTitle:@"All Pages" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        self.textView.rangeLabel.text = @"Page Range: ALL";
-        }];
-    UIAlertAction *customRange = [UIAlertAction actionWithTitle:@"Custom Page Range" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [self createCustomRangeAlert];
-        }];
-    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-            
-        }];
-    [alertController addAction:defaultRange];
-    [alertController addAction:customRange];
-    [alertController addAction:cancelAction]; 
-    [self presentViewController:alertController animated:YES completion:nil];
-}
-
-- (void)createCustomRangeAlert {
-    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Custom Page Range" message:nil preferredStyle:UIAlertControllerStyleAlert];
-    
-    [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
-        textField.placeholder = @"such as:1,3-5,10";
-    }];
-    [alertController addAction:[UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        
-        self.dataModel.pageString = alertController.textFields.firstObject.text;
-        self.textView.rangeLabel.text = @"Page Range:Custom";
-    }]];
-    [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-    }]];
-    [self presentViewController:alertController animated:YES completion:nil];
-}
 
 - (void)horizontalChange:(UITextField *)text {
-    [_drawView setHorizontal:[text.text floatValue]];
-    _dataModel.horizontalSpacing = [text.text floatValue];
-    [_drawView setNeedsDisplay];
+    [self.drawView setHorizontal:[text.text floatValue]];
+    self.dataModel.horizontalSpacing = [text.text floatValue];
+    [self.drawView setNeedsDisplay];
 }
 
 - (void)verticalChage:(UITextField *)text {
-    [_drawView setVertical:[text.text floatValue]];
-    _dataModel.verticalSpacing = [text.text floatValue];
-    [_drawView setNeedsDisplay];
+    [self.drawView setVertical:[text.text floatValue]];
+    self.dataModel.verticalSpacing = [text.text floatValue];
+    [self.drawView setNeedsDisplay];
 }
 
 #pragma mark - Gesture
 
 - (void)createGestureRecognizer {
     [_textPreview.documentView setUserInteractionEnabled:YES];
-    [_textPreview.watermarkLabel setUserInteractionEnabled:YES];
+    [_textPreview.preLabel setUserInteractionEnabled:YES];
     [_textPreview.rotationBtn setUserInteractionEnabled:YES];
       
     UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapWatermarkLabel:)];
-    [_textPreview.watermarkLabel addGestureRecognizer:tapGestureRecognizer];
+    [_textPreview.preLabel addGestureRecognizer:tapGestureRecognizer];
     
     UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panWatermarkLabel:)];
-    [_textPreview.watermarkLabel addGestureRecognizer:panRecognizer];
+    [_textPreview.preLabel addGestureRecognizer:panRecognizer];
     
     UIPanGestureRecognizer *panRotationBtnRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(rotationWatermarkLabel:)];
     [_textPreview.rotationBtn addGestureRecognizer:panRotationBtnRecognizer];
@@ -237,7 +210,7 @@
 
 - (void)tapWatermarkLabel:(UITapGestureRecognizer *)recognizer {
     _alertController.view.hidden = NO;
-    _alertController.textFields.firstObject.text = _textPreview.watermarkLabel.text;
+    _alertController.textFields.firstObject.text = _textPreview.preLabel.text;
     [self presentViewController:_alertController animated:true completion:nil];
 }
 
@@ -247,27 +220,27 @@
     documentFrame.origin.x -= _textPreview.documentView.frame.origin.x;
     documentFrame.origin.y -= _textPreview.documentView.frame.origin.y;
     
-    [_textPreview.watermarkLabel setCenter:CGPointMake(_textPreview.watermarkLabel.center.x + point.x, _textPreview.watermarkLabel.center.y + point.y)];
+    [_textPreview.preLabel setCenter:CGPointMake(_textPreview.preLabel.center.x + point.x, _textPreview.preLabel.center.y + point.y)];
     [_textPreview.rotationBtn setCenter:CGPointMake(_textPreview.rotationBtn.center.x + point.x, _textPreview.rotationBtn.center.y + point.y)];
     
-    if (!CGRectContainsRect(documentFrame,_textPreview.watermarkLabel.frame)) {
-        [_textPreview.watermarkLabel setCenter:CGPointMake(_textPreview.watermarkLabel.center.x - point.x, _textPreview.watermarkLabel.center.y - point.y)];
+    if (!CGRectContainsRect(documentFrame,_textPreview.preLabel.frame)) {
+        [_textPreview.preLabel setCenter:CGPointMake(_textPreview.preLabel.center.x - point.x, _textPreview.preLabel.center.y - point.y)];
         [_textPreview.rotationBtn setCenter:CGPointMake(_textPreview.rotationBtn.center.x - point.x, _textPreview.rotationBtn.center.y - point.y)];
     }
     
-    _dataModel.tx = _textPreview.watermarkLabel.center.x - (_textPreview.documentView.center.x - _textPreview.documentView.frame.origin.x);
-    _dataModel.ty = _textPreview.documentView.center.y - _textPreview.documentView.frame.origin.y - _textPreview.watermarkLabel.center.y;
+    self.dataModel.tx = _textPreview.preLabel.center.x - (_textPreview.documentView.center.x - _textPreview.documentView.frame.origin.x);
+    self.dataModel.ty = _textPreview.documentView.center.y - _textPreview.documentView.frame.origin.y - _textPreview.preLabel.center.y;
     [recognizer setTranslation:CGPointZero inView:_textPreview.documentView];
-    _shadowWaterLabel.center = _textPreview.watermarkLabel.center;
+    self.shadowWaterLabel.center = _textPreview.preLabel.center;
     
-    _normalWatermarkRect = _shadowWaterLabel.frame;
+    self.normalWatermarkRect = self.shadowWaterLabel.frame;
 }
 
 - (void)rotationWatermarkLabel:(UIPanGestureRecognizer *)recognizer {
     CGPoint point = [recognizer translationInView:_textPreview];
-    CGFloat radian = atan2(point.x + _textPreview.center.x - _textPreview.watermarkLabel.center.x, point.y + _textPreview.center.y - _textPreview.watermarkLabel.center.y);
-    _textPreview.watermarkLabel.transform = CGAffineTransformMakeRotation(-radian);
-    _dataModel.watermarkRotation = (-radian) * 180 / M_PI;
+    CGFloat radian = atan2(point.x + _textPreview.center.x - _textPreview.preLabel.center.x, point.y + _textPreview.center.y - _textPreview.preLabel.center.y);
+    _textPreview.preLabel.transform = CGAffineTransformMakeRotation(-radian);
+    self.dataModel.watermarkRotation = (-radian) * 180 / M_PI;
 }
 
 #pragma mark - Orientation
@@ -276,70 +249,77 @@
     [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
     
     if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft) {
+        [self addSideConstraint];
         
-        [_textView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.right.equalTo(self.view.mas_right).offset(-38);
-            make.left.equalTo(_textPreview.mas_right).offset(0);
-            make.height.equalTo(@205);
-            make.width.equalTo(@(self.view.bounds.size.width));
-            make.bottom.equalTo(self.view.mas_bottom).offset(-40);
+    } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
+        [self addNormalConstraint];
+    }
+    
+    if ([self.drawView isDescendantOfView:self.view]) {
+        _textView.tileSwitch.on = NO;
+        [self.cliView removeFromSuperview];
+        [self.drawView removeFromSuperview];
+    }
+}
+
+- (void)addSideConstraint {
+    [_textView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.right.equalTo(self.view.mas_right).offset(-38);
+        make.left.equalTo(_textPreview.mas_right).offset(0);
+        make.height.equalTo(@205);
+        make.width.equalTo(@(self.view.bounds.size.width));
+        make.bottom.equalTo(self.view.mas_bottom).offset(-40);
+    }];
+    [_textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(0);
+        make.right.equalTo(_textView.mas_left).offset(-5);
+        make.left.equalTo(self.view.mas_left).offset(0);
+        make.bottom.equalTo(self.view.mas_bottom).offset(0);
+    }];
+    
+    if ([self.drawView isDescendantOfView:self.view]) {
+        [self.drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(self.view.mas_top).offset(0);
+            make.right.equalTo(_textView.mas_left).offset(-5);
+            make.left.equalTo(self.view.mas_left).offset(0);
+            make.bottom.equalTo(self.view.mas_bottom).offset(0);
         }];
-        [_textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        [self.cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.view.mas_top).offset(0);
             make.right.equalTo(_textView.mas_left).offset(-5);
             make.left.equalTo(self.view.mas_left).offset(0);
             make.bottom.equalTo(self.view.mas_bottom).offset(0);
         }];
-        
-        if ([_drawView isDescendantOfView:self.view]) {
-            [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.right.equalTo(_textView.mas_left).offset(-5);
-                make.left.equalTo(self.view.mas_left).offset(0);
-                make.bottom.equalTo(self.view.mas_bottom).offset(0);
-            }];
-            [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.right.equalTo(_textView.mas_left).offset(-5);
-                make.left.equalTo(self.view.mas_left).offset(0);
-                make.bottom.equalTo(self.view.mas_bottom).offset(0);
-            }];
-        }
-        
-    } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
-        [_textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+    }
+}
+
+- (void)addNormalConstraint {
+    [_textPreview mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.view.mas_top).offset(0);
+        make.width.equalTo(self.view.mas_width);
+        make.bottom.equalTo(self.view.mas_bottom).offset(-205);
+    }];
+    [_textView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_textPreview.mas_bottom).offset(0);
+        make.width.equalTo(_textPreview.mas_width);
+        make.bottom.equalTo(self.view.mas_bottom).offset(0);
+    }];
+    
+    if ([self.drawView isDescendantOfView:self.view]) {
+        [self.drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(self.view.mas_top).offset(0);
             make.width.equalTo(self.view.mas_width);
             make.bottom.equalTo(self.view.mas_bottom).offset(-205);
         }];
-        [_textView mas_remakeConstraints:^(MASConstraintMaker *make) {
-            make.top.equalTo(_textPreview.mas_bottom).offset(0);
-            make.width.equalTo(_textPreview.mas_width);
-            make.bottom.equalTo(self.view.mas_bottom).offset(0);
+        [self.cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(self.view.mas_top).offset(0);
+            make.width.equalTo(self.view.mas_width);
+            make.bottom.equalTo(self.view.mas_bottom).offset(-205);
         }];
-        
-        if ([_drawView isDescendantOfView:self.view]) {
-            [_drawView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.width.equalTo(self.view.mas_width);
-                make.bottom.equalTo(self.view.mas_bottom).offset(-205);
-            }];
-            [_cliView mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.top.equalTo(self.view.mas_top).offset(0);
-                make.width.equalTo(self.view.mas_width);
-                make.bottom.equalTo(self.view.mas_bottom).offset(-205);
-            }];
-        }
-    }
-    
-    if ([_drawView isDescendantOfView:self.view]) {
-        [_drawView setDocumentViewRect:_textPreview.documentView.frame];
-        [_drawView setWaterLabelRect:_textPreview.watermarkLabel.frame];
-        [_drawView setNeedsDisplay];
-        [_cliView setNeedsDisplay];
     }
 }
 
+
 #pragma mark - CPDFClipTextPreviewDelegate
 
 - (void)clipText:(CGContextRef)context {
@@ -402,23 +382,4 @@
     return YES;
 }
 
-- (BOOL)validateValue:(NSString *)number {
-    BOOL res = YES;
-    NSCharacterSet *numberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
-    
-    NSInteger i = 0;
-    while (i < number.length) {
-        NSString *str = [number substringWithRange:NSMakeRange(i, 1)];
-        NSRange range = [str rangeOfCharacterFromSet:numberSet];
-        
-        if (range.length == 0) {
-            res = NO;
-            break;
-        }
-        i++;
-    }
-    
-    return  res;
-}
-
 @end

+ 2 - 2
PDFViewer/Controller/CPDFViewController.h

@@ -6,12 +6,12 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "CPDFHeaderFooterModel.h"
+#import "PDFHeaderFooterModel.h"
 
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFViewController : UIViewController
+@interface PDFViewController : UIViewController
 
 @property (nonatomic,copy) NSString *path;
 

+ 88 - 94
PDFViewer/Controller/CPDFViewController.m

@@ -9,36 +9,32 @@
 #import <ComPDFKit/ComPDFKit.h>
 #import <ComPDFKit/CPDFWatermark.h>
 #import <ComPDFKit/CPDFHeaderFooter.h>
-#import "CPDFViewController.h"
-#import "CPDFTextPreview.h"
-#import "CPDFImagePreview.h"
-#import "CPDFTextView.h"
-#import "CPDFImageView.h"
-#import "CPDFDataModel.h"
-#import "CPDFBackgroundModel.h"
+#import "PDFViewController.h"
+#import "PDFTextPreview.h"
+#import "PDFImagePreview.h"
+#import "PDFDataModel.h"
+#import "PDFBackgroundModel.h"
 #import "Masonry.h"
-#import "CPDFAddWaterMarkViewController.h"
-#import "CPDFBackgroundSettingViewController.h"
-#import "CPDFHeaderFooterAddController.h"
-#import "CPDFBatesAddViewController.h"
-#import "CPDFSettingView.h"
+#import "PDFAddWaterMarkViewController.h"
+#import "PDFBackgroundSettingViewController.h"
+#import "PDFHeaderFooterAddController.h"
+#import "PDFBatesAddViewController.h"
+#import "PDFSettingView.h"
 
-@interface CPDFViewController () <UIActionSheetDelegate,WaterMarkModelDataDelegate,BackgroundDataModelDelegate,CPDFModelDataDelegate>
+@interface PDFViewController () <UIActionSheetDelegate,WaterMarkModelDataDelegate,BackgroundDataModelDelegate,PDFModelDataDelegate>
 
 @property (nonatomic,strong) CPDFView *pdfView;
 @property (nonatomic,strong) CPDFDocument *pdfDocument;
-@property (nonatomic,strong) CPDFWatermark *textWatermark;
-@property (nonatomic,strong) CPDFWatermark *imageWatermark;
-@property (nonatomic,strong) CPDFAddWaterMarkViewController *addWaterMarkViewController;
-@property (nonatomic,strong) CPDFBackgroundSettingViewController * addBackgroundViewController;
+@property (nonatomic,strong) PDFAddWaterMarkViewController *addWaterMarkViewController;
 @property (nonatomic,strong) UIImage *image;
-@property (nonatomic,assign) CGSize imageSize;
-@property (nonatomic,strong) CPDFSettingView *headerFooterSetting;
-@property (nonatomic,strong) CPDFSettingView *batesSetting;
+@property (nonatomic,strong) PDFSettingView *headerFooterSetting;
+@property (nonatomic,strong) PDFSettingView *batesSetting;
 
 @end
 
-@implementation CPDFViewController
+@implementation PDFViewController
+
+#pragma mark - Initializers
 
 - (instancetype)initWithPath:(NSString *)inPath {
     if (self = [super init]) {
@@ -47,13 +43,15 @@
     return self;
 }
 
+#pragma mark - UIViewController Methods
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     //add UIBarButtonItem in Navigation
     self.navigationController.toolbarHidden = YES;
     UIImage *btnMore = [UIImage imageNamed:@"btn_more"];
-    UIBarButtonItem *ringhtBarItem = [[UIBarButtonItem alloc] initWithImage:btnMore style:UIBarButtonItemStylePlain target:self action:@selector(onClickedOkbtn)];
+    UIBarButtonItem *ringhtBarItem = [[UIBarButtonItem alloc] initWithImage:btnMore style:UIBarButtonItemStylePlain target:self action:@selector(PDFViewPerformOnClickedOkbtn)];
     self.navigationItem.rightBarButtonItem = ringhtBarItem;
     
     //setting URL
@@ -65,22 +63,22 @@
     [self.view addSubview:_pdfView];
         
     CPDFPage *pdfPage = [_pdfView.document pageAtIndex:0];
-    _imageSize = [_pdfView.document pageSizeAtIndex:0];
-    _image = [pdfPage thumbnailOfSize:_imageSize];
+    CGSize imageSize = [_pdfView.document pageSizeAtIndex:0];
+    _image = [pdfPage thumbnailOfSize:imageSize];
     
-    _headerFooterSetting = [[CPDFSettingView alloc] init];
+    _headerFooterSetting = [[PDFSettingView alloc] init];
     [_headerFooterSetting setText];
     
-    _batesSetting = [[CPDFSettingView alloc] init];
+    _batesSetting = [[PDFSettingView alloc] init];
     [_batesSetting setText];
 }
 
-#pragma mark - Actions
+#pragma mark - PDFViewer - More : Import HeaderFooter, Bates, Watermark, Background
 
-- (void)onClickedOkbtn {
+- (void)PDFViewPerformOnClickedOkbtn {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     UIAlertAction *addWatermarkAction = [UIAlertAction actionWithTitle:@"Add Watermark" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        self.addWaterMarkViewController = [[CPDFAddWaterMarkViewController alloc] initWithDocument:self.pdfDocument];
+        self.addWaterMarkViewController = [[PDFAddWaterMarkViewController alloc] initWithDocument:self.pdfDocument];
         self.addWaterMarkViewController.delegate = self;
         
         [self.navigationController pushViewController:self.addWaterMarkViewController animated:YES];
@@ -88,19 +86,19 @@
     
     // Setting headerfooter action
     UIAlertAction *settingHeaderFooter = [UIAlertAction actionWithTitle:@"Setting Headerfooter" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [self settingHeaderFooter];
+        [self PDFViewPerformSettingHeaderFooter];
        }];
     
     // Seeting bates action
     UIAlertAction *settingBatesAction = [UIAlertAction actionWithTitle:@"Setting Bates" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [self settingBates];
+        [self PDFViewPerformSettingBates];
        }];
     
     UIAlertAction *addBackgroundAction = [UIAlertAction actionWithTitle:@"Add Background" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        self.addBackgroundViewController = [[CPDFBackgroundSettingViewController alloc] initWithDocument:self.pdfDocument];
-        self.addBackgroundViewController.delegate = self;
+        PDFBackgroundSettingViewController * addBackgroundViewController = [[PDFBackgroundSettingViewController alloc] initWithDocument:self.pdfDocument];
+        addBackgroundViewController.delegate = self;
         
-        [self.navigationController pushViewController:self.addBackgroundViewController animated:YES];
+        [self.navigationController pushViewController:addBackgroundViewController animated:YES];
         
         }];
     
@@ -117,9 +115,9 @@
     [self presentViewController:alertController animated:YES completion:nil];
 }
 
-#pragma mark - Setting Pop
+#pragma mark - PDFViewer - More :Add / Delete images HeaderFooter and Bates
 
-- (void)settingHeaderFooter {
+- (void)PDFViewPerformSettingHeaderFooter {
     [self.view addSubview:_headerFooterSetting];
     
     [_headerFooterSetting mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -133,11 +131,11 @@
         self.headerFooterSetting.center = CGPointMake(self.headerFooterSetting.center.x, self.headerFooterSetting.center.y - 100);
     } completion:nil];
     
-    [_headerFooterSetting.addButton addTarget:self action:@selector(addHeaderFooter:) forControlEvents:UIControlEventTouchUpInside];
-    [_headerFooterSetting.deleteButton addTarget:self action:@selector(deleteHeaderFooter:) forControlEvents:UIControlEventTouchUpInside];
+    [_headerFooterSetting.addButton addTarget:self action:@selector(PDFViewPerformAddHeaderFooter:) forControlEvents:UIControlEventTouchUpInside];
+    [_headerFooterSetting.deleteButton addTarget:self action:@selector(PDFViewPerformDeleteHeaderFooter:) forControlEvents:UIControlEventTouchUpInside];
 }
 
-- (void)settingBates {
+- (void)PDFViewPerformSettingBates {
     [self.view addSubview:_batesSetting];
     
     [_batesSetting mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -151,14 +149,12 @@
         self.batesSetting.center = CGPointMake(self.batesSetting.center.x, self.batesSetting.center.y - 100);
     } completion:nil];
     
-    [_batesSetting.addButton addTarget:self action:@selector(addBates:) forControlEvents:UIControlEventTouchUpInside];
-    [_batesSetting.deleteButton addTarget:self action:@selector(deleteBates:) forControlEvents:UIControlEventTouchUpInside];
+    [_batesSetting.addButton addTarget:self action:@selector(PDFViewPerformAddBates:) forControlEvents:UIControlEventTouchUpInside];
+    [_batesSetting.deleteButton addTarget:self action:@selector(PDFViewPerformDeleteBates:) forControlEvents:UIControlEventTouchUpInside];
 }
 
-#pragma mark - Actions
-
-- (void)addHeaderFooter:(UIButton *)btn {
-    CPDFHeaderFooterAddController *headerFooterControl = [[CPDFHeaderFooterAddController alloc] initWithImage:self.image];
+- (void)PDFViewPerformAddHeaderFooter:(UIButton *)btn {
+    PDFHeaderFooterAddController *headerFooterControl = [[PDFHeaderFooterAddController alloc] initWithImage:self.image];
 
     headerFooterControl.delegate = self;
 
@@ -169,16 +165,16 @@
     } completion:nil];
 }
 
-- (void)deleteHeaderFooter:(UIButton *)btn {
-    [self deleteHeaderFooterAction];
+- (void)PDFViewPerformDeleteHeaderFooter:(UIButton *)btn {
+    [self PDFViewPerformDeleteHeaderFooterAction];
     
     [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
         self.headerFooterSetting.center = CGPointMake(self.headerFooterSetting.center.x, self.headerFooterSetting.center.y + 100);
     } completion:nil];
 }
 
-- (void)addBates:(UIButton *)btn {
-    CPDFBatesAddViewController *batesAddControl = [[CPDFBatesAddViewController alloc] initWithImage:self.image];
+- (void)PDFViewPerformAddBates:(UIButton *)btn {
+    PDFBatesAddViewController *batesAddControl = [[PDFBatesAddViewController alloc] initWithImage:self.image];
     
     batesAddControl.delegate = self;
     
@@ -189,22 +185,20 @@
     } completion:nil];
 }
 
-- (void)deleteBates:(UIButton *)btn {
-    [self deleteBatesAction];
+- (void)PDFViewPerformDeleteBates:(UIButton *)btn {
+    [self PDFViewPerformDeleteBatesAction];
     
     [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
         self.batesSetting.center = CGPointMake(self.batesSetting.center.x, self.batesSetting.center.y + 100);
     } completion:nil];
 }
 
-#pragma mark - Delete Alert
-
 // Detele headerfootr action
-- (void)deleteHeaderFooterAction {
+- (void)PDFViewPerformDeleteHeaderFooterAction {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Delete Page Number" message:@"Are you sure delete all pages number" preferredStyle:UIAlertControllerStyleAlert];
     
     UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [self deleteHeaderFooter];
+        [self PDFViewPerformDeleteHeaderFooter];
         }];
     
     UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
@@ -218,12 +212,12 @@
 }
 
 // Delete bates action
-- (void)deleteBatesAction {
+- (void)PDFViewPerformDeleteBatesAction {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Delete Bates" message:@"Are you sure delete all Bates" preferredStyle:UIAlertControllerStyleAlert];
     
     UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         
-        [self deleteBates];
+        [self PDFViewPerformDeleteBates];
         }];
     
     UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
@@ -239,7 +233,7 @@
 #pragma mark - CPDFModelDataDelegate
 
 // Get headerfooter' model to setting page headerfooter's add functional property
-- (void)changeHeaderFooterModelData:(CPDFHeaderFooterModel *)modelData {
+- (void)PDFViewPerformChangeHeaderFooter:(PDFHeaderFooterModel *)modelData {
     CPDFHeaderFooter *headerFooter = [self.pdfDocument headerFooter];
 
     NSString *pageIndex = [NSString stringWithFormat:@"0-%lu",self.pdfDocument.pageCount - 1];
@@ -283,8 +277,8 @@
 }
 
 // Get bates' model to setting page bates's add functional property
-- (void)changBatesModelData:(CPDFHeaderFooterModel *)modelData {
-    CPDFHeaderFooterModel *modelBatesData = modelData;
+- (void)PDFViewPerformChangBates:(PDFHeaderFooterModel *)modelData {
+    PDFHeaderFooterModel *modelBatesData = modelData;
     
     CPDFBates *bates = [self.pdfDocument bates];
     
@@ -311,7 +305,7 @@
 #pragma mark - Delete Methods
 
 // Get headerfooter' model to setting page headerfooter's delete functional property
-- (void)deleteHeaderFooter {
+- (void)PDFViewPerformDeleteHeaderFooter {
     CPDFHeaderFooter *headerFooter = [self.pdfDocument headerFooter];
     [headerFooter clear];
     
@@ -326,7 +320,7 @@
 }
 
 // Get bates' model to setting page bates's delete functional property
-- (void)deleteBates {
+- (void)PDFViewPerformDeleteBates {
     CPDFBates *bates = [self.pdfDocument bates];
     [bates clear];
     
@@ -342,70 +336,70 @@
 
 #pragma mark - WaterMarkModelDataDelegate
 
-- (void)changeTextModel:(CPDFDataModel *)dataModel {
-    _textWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfDocument type:CPDFWatermarkTypeText];
+- (void)PDFViewPerformChangeTextWatermark:(PDFDataModel *)dataModel {
+    CPDFWatermark *textWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfDocument type:CPDFWatermarkTypeText];
     
-    _textWatermark.text = dataModel.text;
-    _textWatermark.textColor = dataModel.textColor;
+    textWatermark.text = dataModel.text;
+    textWatermark.textColor = dataModel.textColor;
     
-    _textWatermark.opacity = dataModel.watermarkOpacity;
+    textWatermark.opacity = dataModel.watermarkOpacity;
     
-    _textWatermark.scale = dataModel.watermarkScale * 2.5;
+    textWatermark.scale = dataModel.watermarkScale * 2.5;
     
-    _textWatermark.isTilePage = dataModel.isTile;
+    textWatermark.isTilePage = dataModel.isTile;
     
-    _textWatermark.tx = dataModel.tx * _imageSize.width / self.addWaterMarkViewController.textViewController.textPreview.documentView.frame.size.width;
-    _textWatermark.ty = dataModel.ty * _imageSize.height / self.addWaterMarkViewController.textViewController.textPreview.documentView.frame.size.height;
+    textWatermark.tx = dataModel.tx * (_image.size.width / 3) / self.addWaterMarkViewController.textViewController.textPreview.documentView.frame.size.width;
+    textWatermark.ty = dataModel.ty * (_image.size.height / 3) / self.addWaterMarkViewController.textViewController.textPreview.documentView.frame.size.height;
     
-    _textWatermark.rotation = dataModel.watermarkRotation;
+    textWatermark.rotation = dataModel.watermarkRotation;
     
-    if (_textWatermark.isTilePage) {
-        _textWatermark.verticalSpacing = dataModel.verticalSpacing;
-        _textWatermark.horizontalSpacing = dataModel.horizontalSpacing;
+    if (textWatermark.isTilePage) {
+        textWatermark.verticalSpacing = dataModel.verticalSpacing;
+        textWatermark.horizontalSpacing = dataModel.horizontalSpacing;
     }
     
     if (dataModel.pageString) {
-        _textWatermark.pageString = dataModel.pageString;
+        textWatermark.pageString = dataModel.pageString;
     }
     
-    [_pdfView.document addWatermark:_textWatermark];
+    [_pdfView.document addWatermark:textWatermark];
     [_pdfView layoutDocumentView];
     NSURL *url = [NSURL fileURLWithPath:_path];
     [_pdfView.document writeToURL:url];
 }
 
-- (void)changeImageModel:(CPDFDataModel *)dataModel {
-    _imageWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfDocument type:CPDFWatermarkTypeImage];
+- (void)PDFViewPerformChangeImageWatermark:(PDFDataModel *)dataModel {
+    CPDFWatermark *imageWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfDocument type:CPDFWatermarkTypeImage];
     
-    _imageWatermark.image = dataModel.image;
+    imageWatermark.image = dataModel.image;
     
-    _imageWatermark.opacity = dataModel.watermarkOpacity;
+    imageWatermark.opacity = dataModel.watermarkOpacity;
     
-    _imageWatermark.scale = dataModel.watermarkScale * 2;
+    imageWatermark.scale = dataModel.watermarkScale * 2;
     
-    _imageWatermark.isTilePage = dataModel.isTile;
+    imageWatermark.isTilePage = dataModel.isTile;
     
-    _imageWatermark.tx = dataModel.tx * _imageSize.width / self.addWaterMarkViewController.imageViewController.imagePreview.documentView.frame.size.width;
-    _imageWatermark.ty = dataModel.ty * _imageSize.height / self.addWaterMarkViewController.imageViewController.imagePreview.documentView.frame.size.height;
+    imageWatermark.tx = dataModel.tx * (_image.size.width / 3) / self.addWaterMarkViewController.imageViewController.imagePreview.documentView.frame.size.width;
+    imageWatermark.ty = dataModel.ty * (_image.size.height / 3) / self.addWaterMarkViewController.imageViewController.imagePreview.documentView.frame.size.height;
     
-    _imageWatermark.rotation = dataModel.watermarkRotation;
+    imageWatermark.rotation = dataModel.watermarkRotation;
     
-    if (_imageWatermark.isTilePage) {
-        _imageWatermark.verticalSpacing = dataModel.verticalSpacing;
-        _imageWatermark.horizontalSpacing = dataModel.horizontalSpacing;
+    if (imageWatermark.isTilePage) {
+        imageWatermark.verticalSpacing = dataModel.verticalSpacing;
+        imageWatermark.horizontalSpacing = dataModel.horizontalSpacing;
     }
     
     if (dataModel.pageString) {
-        _imageWatermark.pageString = dataModel.pageString;
+        imageWatermark.pageString = dataModel.pageString;
     }
     
-    [_pdfView.document addWatermark:_imageWatermark];
+    [_pdfView.document addWatermark:imageWatermark];
     [_pdfView layoutDocumentView];
     NSURL *url = [NSURL fileURLWithPath:_path];
     [_pdfView.document writeContentToURL:url];
 }
 
-- (void)deleteTextModel:(CPDFWatermark *)waterMark {
+- (void)PDFViewPerformDeleteWatermark:(CPDFWatermark *)waterMark {
     [self.pdfDocument removeWatermark:waterMark];
     NSURL *url = [NSURL fileURLWithPath:_path];
     [_pdfView.document writeToURL:url];
@@ -419,7 +413,7 @@
 
 #pragma mark - BackgroundDataModelDelegate
 
-- (void)changeBackgroundModel:(CPDFBackgroundModel *)dataModel {
+- (void)PDFViewPerformChangeBackground:(PDFBackgroundModel *)dataModel {
     CPDFBackground *pageBackground = [_pdfDocument background];
     
     pageBackground.color = dataModel.backgroundColor;
@@ -445,7 +439,7 @@
     [self.view addSubview:_pdfView];
 }
 
-- (void)deleteBackgroundModel {
+- (void)PDFViewPerformDeleteBackground {
     CPDFBackground *pageBackground = [_pdfDocument background];
     
     [pageBackground clear];

+ 1 - 1
PDFViewer/Model/CPDFBackgroundModel.h

@@ -10,7 +10,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFBackgroundModel : NSObject
+@interface PDFBackgroundModel : NSObject
 
 @property (nonatomic,strong) UIColor *backgroundColor;
 

+ 2 - 2
PDFViewer/Model/CPDFBackgroundModel.m

@@ -5,8 +5,8 @@
 //  Created by kdanmobile_2 on 2023/1/4.
 //
 
-#import "CPDFBackgroundModel.h"
+#import "PDFBackgroundModel.h"
 
-@implementation CPDFBackgroundModel
+@implementation PDFBackgroundModel
 
 @end

+ 1 - 1
PDFViewer/Model/CPDFDataModel.h

@@ -10,7 +10,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFDataModel : NSObject
+@interface PDFDataModel : NSObject
 
 @property (nonatomic,copy) NSString *text;
 @property (nonatomic,strong) UIColor *textColor;

+ 2 - 2
PDFViewer/Model/CPDFDataModel.m

@@ -5,9 +5,9 @@
 //  Created by kdan on 2022/11/21.
 //
 
-#import "CPDFDataModel.h"
+#import "PDFDataModel.h"
 
-@implementation CPDFDataModel
+@implementation PDFDataModel
 
 -(instancetype)init {
     if (self = [super init]) {

+ 1 - 1
PDFViewer/Model/CPDFHeaderFooterModel.h

@@ -10,7 +10,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFHeaderFooterModel : NSObject
+@interface PDFHeaderFooterModel : NSObject
 
 @property (nonatomic,strong) UIColor *fontColor;
 @property (nonatomic,assign) NSUInteger fontPosition;

+ 2 - 2
PDFViewer/Model/CPDFHeaderFooterModel.m

@@ -5,8 +5,8 @@
 //  Created by kdanmobile_2 on 2022/11/21.
 //
 
-#import "CPDFHeaderFooterModel.h"
+#import "PDFHeaderFooterModel.h"
 
-@implementation CPDFHeaderFooterModel
+@implementation PDFHeaderFooterModel
 
 @end

+ 1 - 1
PDFViewer/Model/CPDFModel.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFModel : NSObject
+@interface PDFModel : NSObject
 
 @property (nonatomic,copy) NSString *fileName;
 @property (nonatomic,copy) NSString *filePath;

+ 2 - 2
PDFViewer/Model/CPDFModel.m

@@ -5,8 +5,8 @@
 //  Created by kdan on 2022/11/14.
 //
 
-#import "CPDFModel.h"
+#import "PDFModel.h"
 
-@implementation CPDFModel
+@implementation PDFModel
 
 @end

+ 4 - 4
PDFViewer/SceneDelegate.m

@@ -7,8 +7,8 @@
 
 #import <ComPDFKit/ComPDFKit.h>
 #import "SceneDelegate.h"
-#import "CPDFListController.h"
-#import "CPDFModel.h"
+#import "PDFListController.h"
+#import "PDFModel.h"
 
 @interface SceneDelegate ()
 
@@ -45,11 +45,11 @@
         }
     }
     
-     CPDFModel *model = [[CPDFModel alloc] init];
+     PDFModel *model = [[PDFModel alloc] init];
     model.filePath = docsFolder;
     NSLog(@"%@",model.filePath);
     
-    CPDFListController *pdfController = [[CPDFListController alloc] initWithModel:model];
+    PDFListController *pdfController = [[PDFListController alloc] initWithModel:model];
     
     UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:pdfController];
     pdfController.navigationItem.title = @"Documents";

+ 0 - 43
PDFViewer/View/CPDFBackgroundPreview.m

@@ -1,43 +0,0 @@
-//
-//  CPDFBackgroundPreview.m
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2023/1/2.
-//
-
-#import "CPDFBackgroundPreview.h"
-#import "Masonry.h"
-
-@implementation CPDFBackgroundPreview
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    
-    if (self) {
-        _documentView = [[UIImageView alloc] init];
-        [self addSubview:_documentView];
-        
-        _imageView = [[UIImageView alloc] init];
-        [self addSubview:_imageView];
-        
-        self.backgroundColor = [UIColor systemGray5Color];
-    }
-    
-    return self;
-}
-
-- (void)drawRect:(CGRect)rect {
-    [super drawRect:rect];
-    
-    _imageView.layer.borderColor = UIColor.blueColor.CGColor;
-    _imageView.layer.borderWidth = 1;
-    [_imageView sizeToFit];
-    _imageView.contentMode = UIViewContentModeScaleAspectFit;
-    
-    CGRect frame = _imageView.frame;
-    frame.origin = CGPointMake(_documentView.bounds.size.width / 2 - _imageView.frame.size.width / 2, _documentView.bounds.size.height / 2 - _imageView.frame.size.height / 2);
-    
-    _imageView.frame = frame;
-}
-
-@end

+ 0 - 27
PDFViewer/View/CPDFClipView.h

@@ -1,27 +0,0 @@
-//
-//  CPDFClipView.h
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/12/23.
-//
-
-#import <UIKit/UIKit.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@protocol CPDFClipTextPreviewDelegate <NSObject>
-
-@required
-
-- (void)clipText:(CGContextRef)context;
-
-@end
-
-
-@interface CPDFClipView : UIView
-
-@property (nonatomic,strong) id<CPDFClipTextPreviewDelegate> delegate;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 59
PDFViewer/View/CPDFImagePreview.m

@@ -1,59 +0,0 @@
-//
-//  CPDFImagePreview.m
-//  PDFViewer
-//
-//  Created by kdan on 2022/11/18.
-//
-
-#import "CPDFImagePreview.h"
-#import "Masonry.h"
-
-BOOL gImagePreviewIsFirstLayout = YES;
-
-@implementation CPDFImagePreview
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if (self = [super initWithFrame:frame]) {
-        _watermarkView = [[UIImageView alloc] init];
-        _rotationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        _documentView = [[UIImageView alloc] init];
-
-        [self addSubview:_documentView];
-        [_documentView addSubview:_watermarkView];
-        [_watermarkView addSubview:_rotationBtn];
-    }
-    return self;
-}
-
-#pragma mark - Layout
-
-- (void)layoutSubviews {
-    [super layoutSubviews];
-    
-    _watermarkView.layer.borderColor = UIColor.blueColor.CGColor;
-    _watermarkView.layer.borderWidth = 1;
-    [_watermarkView sizeToFit];
-    _watermarkView.contentMode = UIViewContentModeScaleAspectFit;
-    
-    CGRect frame = _watermarkView.frame;
-    frame.origin = CGPointMake(_documentView.bounds.size.width / 2 - _watermarkView.frame.size.width / 2, _documentView.bounds.size.height / 2 - _watermarkView.frame.size.height / 2);
-    _watermarkFrame = frame;
-    
-    _watermarkView.frame = _watermarkFrame;
-    
-    [_rotationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_watermarkView.mas_bottom).offset(-10);
-        make.width.equalTo(@20);
-        make.height.equalTo(@20);
-        make.left.equalTo(_watermarkView.mas_right).offset(-10);
-    }];
-    
-    _rotationBtn.layer.cornerRadius = 10;
-    _rotationBtn.layer.masksToBounds = YES;
-    _rotationBtn.layer.borderColor = UIColor.blueColor.CGColor;
-    [_rotationBtn setBackgroundImage:[UIImage imageNamed:@"btn_selected"] forState:UIControlStateNormal];
-    
-}
-
-@end

+ 0 - 49
PDFViewer/View/HeaderFooterView/CPDFHeadView.m

@@ -1,49 +0,0 @@
-//
-//  CPDFHeadView.m
-//  PDFViewer
-//
-//  Created by kdanmobile_2 on 2022/12/7.
-//
-
-#import "CPDFHeadView.h"
-
-@implementation CPDFHeadView
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    self = [super initWithFrame:frame];
-    if (self) {
-        _imageView = [[UIImageView alloc] init];
-        
-        _imageView.image = self.image;
-        CALayer *layer = [_imageView layer];
-        layer.borderColor = [[UIColor blackColor] CGColor];
-        layer.borderWidth = 0.5f;
-        [self addSubview:_imageView];
-        
-        _showLabel = [[UILabel alloc] init];
-        [_showLabel setText:@"1"];
-        _showLabel.font = [UIFont systemFontOfSize:6];
-        [self.imageView addSubview:self.showLabel];
-    }
-    return self;
-}
-
-- (void)drawRect:(CGRect)rect {
-    [super drawRect:rect];
-    
-    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(self.mas_top);
-        make.left.equalTo(self.mas_left);
-        make.width.mas_equalTo(self.image.size.width / 9);
-        make.height.mas_equalTo(self.image.size.height / 9);
-    }];
-    
-    [_showLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_imageView.mas_top).offset(0.5);
-        make.left.equalTo(self.imageView.mas_left).offset(0.5);
-        make.height.mas_equalTo(10);
-        make.width.mas_equalTo(20);
-    }];
-}
-
-@end

+ 1 - 1
PDFViewer/View/HeaderFooterView/CPDFAddView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFAddView : UIView
+@interface PDFAddView : UIView
 
 @property (nonatomic,strong) UILabel *localLabel;
 @property (nonatomic,strong) UISegmentedControl *localSegment;

+ 2 - 2
PDFViewer/View/HeaderFooterView/CPDFAddView.m

@@ -5,10 +5,10 @@
 //  Created by kdanmobile_2 on 2022/12/5.
 //
 
-#import "CPDFAddView.h"
+#import "PDFAddView.h"
 #import "Masonry.h"
 
-@implementation CPDFAddView
+@implementation PDFAddView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];

+ 2 - 2
PDFViewer/View/HeaderFooterView/CPDFBatesAddView.h

@@ -6,11 +6,11 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "CPDFAddView.h"
+#import "PDFAddView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFBatesAddView : CPDFAddView <UITextFieldDelegate>
+@interface PDFBatesAddView : PDFAddView <UITextFieldDelegate>
 
 @property (nonatomic,strong) UILabel *pageNumberLabel;
 @property (nonatomic,strong) UITextField *pageNumberText;

+ 29 - 2
PDFViewer/View/HeaderFooterView/CPDFBatesAddView.m

@@ -5,10 +5,10 @@
 //  Created by kdanmobile_2 on 2022/11/18.
 //
 
-#import "CPDFBatesAddView.h"
+#import "PDFBatesAddView.h"
 #import "Masonry.h"
 
-@implementation CPDFBatesAddView
+@implementation PDFBatesAddView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
@@ -150,4 +150,31 @@
     return YES;
 }
 
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+    if (_pageIndexNumberText == textField) {
+        return [self validateValue:string];
+    }
+    
+    return YES;
+}
+
+- (BOOL)validateValue:(NSString *)number {
+    BOOL res = YES;
+    NSCharacterSet *numberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
+    
+    NSInteger i = 0;
+    while (i < number.length) {
+        NSString *str = [number substringWithRange:NSMakeRange(i, 1)];
+        NSRange range = [str rangeOfCharacterFromSet:numberSet];
+        
+        if (range.length == 0) {
+            res = NO;
+            break;
+        }
+        i++;
+    }
+    
+    return  res;
+}
+
 @end

+ 2 - 4
PDFViewer/View/HeaderFooterView/CPDFHeadView.h

@@ -6,16 +6,14 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "PDFPreView.h"
 #import "Masonry.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFHeadView : UIView
+@interface PDFHeadView : PDFPreView
 
-@property (nonatomic,strong) UILabel *showLabel;
-@property (nonatomic,strong) UIImageView *imageView;
 @property (nonatomic,strong) UIImage *image;
-@property (nonatomic,assign) CGSize size;
 
 @end
 

+ 42 - 0
PDFViewer/View/HeaderFooterView/PDFHeadView.m

@@ -0,0 +1,42 @@
+//
+//  CPDFHeadView.m
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/12/7.
+//
+
+#import "PDFHeadView.h"
+
+@implementation PDFHeadView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        
+        self.preLabel = [[UILabel alloc] init];
+        [self.preLabel setText:@"1"];
+        self.preLabel.font = [UIFont systemFontOfSize:6];
+        [self.documentView addSubview:self.preLabel];
+    }
+    return self;
+}
+
+- (void)drawRect:(CGRect)rect {
+    [super drawRect:rect];
+    
+    [self.documentView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.mas_top);
+        make.left.equalTo(self.mas_left);
+        make.width.mas_equalTo(self.image.size.width / 9);
+        make.height.mas_equalTo(self.image.size.height / 9);
+    }];
+    
+    [self.preLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.documentView.mas_top).offset(0.5);
+        make.left.equalTo(self.documentView.mas_left).offset(0.5);
+        make.height.mas_equalTo(10);
+        make.width.mas_equalTo(20);
+    }];
+}
+
+@end

+ 2 - 4
PDFViewer/View/HeaderFooterView/CPDFHeaderFooterAddView.h

@@ -6,13 +6,11 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "CPDFAddView.h"
+#import "PDFAddView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-#define kNumber @"^[0-9]+$";
-
-@interface CPDFHeaderFooterAddView : CPDFAddView  <UITextFieldDelegate>
+@interface PDFHeaderFooterAddView : PDFAddView  <UITextFieldDelegate>
 
 @property (nonatomic,strong) UILabel *pageNumberLabel;
 @property (nonatomic,strong) UITextField *pageNumberText;

+ 27 - 5
PDFViewer/View/HeaderFooterView/CPDFHeaderFooterAddView.m

@@ -5,10 +5,10 @@
 //  Created by kdanmobile_2 on 2022/11/16.
 //
 
-#import "CPDFHeaderFooterAddView.h"
+#import "PDFHeaderFooterAddView.h"
 #import "Masonry.h"
 
-@implementation CPDFHeaderFooterAddView
+@implementation PDFHeaderFooterAddView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
@@ -157,10 +157,32 @@
 }
 
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-    NSString *number = kNumber;
-    NSPredicate *numberPre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",number];
-    return [numberPre evaluateWithObject:string];
+    if (_fontSizeText == textField || _pageNumberText == textField) {
+        return [self validateValue:string];
+    }
+    
+    return YES;
 }
 
+- (BOOL)validateValue:(NSString *)number {
+    BOOL res = YES;
+    NSCharacterSet *numberSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
+    
+    NSInteger i = 0;
+    while (i < number.length) {
+        NSString *str = [number substringWithRange:NSMakeRange(i, 1)];
+        NSRange range = [str rangeOfCharacterFromSet:numberSet];
+        
+        if (range.length == 0) {
+            res = NO;
+            break;
+        }
+        i++;
+    }
+    
+    return  res;
+}
+
+
 @end
 

+ 1 - 1
PDFViewer/View/HeaderFooterView/CPDFHeaderFooterTextTableView.h

@@ -10,7 +10,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFHeaderFooterTextTableView : UIView 
+@interface PDFHeaderFooterTextTableView : UIView 
 
 @property (nonatomic,strong) UITableView *tableView;
 @property (nonatomic,strong) UILabel *titleView;

+ 2 - 2
PDFViewer/View/HeaderFooterView/CPDFHeaderFooterTextTableView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2022/11/25.
 //
 
-#import "CPDFHeaderFooterTextTableView.h"
+#import "PDFHeaderFooterTextTableView.h"
 
-@implementation CPDFHeaderFooterTextTableView
+@implementation PDFHeaderFooterTextTableView
 
 - (instancetype)initWithTitleName:(NSString *)titleName {
     self = [super init];

+ 1 - 1
PDFViewer/View/HeaderFooterView/CPDFSettingView.h

@@ -10,7 +10,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFSettingView : UIView
+@interface PDFSettingView : UIView
 
 @property (nonatomic,strong) UILabel *settinigLabel;
 @property (nonatomic,strong) UIButton *addButton;

+ 2 - 2
PDFViewer/View/HeaderFooterView/CPDFSettingView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2022/12/13.
 //
 
-#import "CPDFSettingView.h"
+#import "PDFSettingView.h"
 
-@implementation CPDFSettingView
+@implementation PDFSettingView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];

+ 2 - 3
PDFViewer/View/CPDFBackgroundPreview.h

@@ -6,13 +6,12 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "PDFPreView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFBackgroundPreview : UIView
+@interface PDFBackgroundPreview : PDFPreView
 
-@property (nonatomic,strong) UIImageView *documentView;
-@property (nonatomic,strong) UIImageView *imageView;
 @property (nonatomic,strong) UIColor *tintColor;
 
 @end

+ 40 - 0
PDFViewer/View/PDFBackgroundPreview.m

@@ -0,0 +1,40 @@
+//
+//  CPDFBackgroundPreview.m
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/2.
+//
+
+#import "PDFBackgroundPreview.h"
+#import "Masonry.h"
+
+@implementation PDFBackgroundPreview
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    
+    if (self) {
+        
+        [self addSubview:self.preImageView];
+        
+        self.backgroundColor = [UIColor systemGray5Color];
+    }
+    
+    return self;
+}
+
+- (void)drawRect:(CGRect)rect {
+    [super drawRect:rect];
+    
+    self.preImageView.layer.borderColor = UIColor.blueColor.CGColor;
+    self.preImageView.layer.borderWidth = 1;
+    [self.preImageView sizeToFit];
+    self.preImageView.contentMode = UIViewContentModeScaleAspectFit;
+    
+    CGRect frame = self.preImageView.frame;
+    frame.origin = CGPointMake(self.documentView.bounds.size.width / 2 - self.preImageView.frame.size.width / 2, self.documentView.bounds.size.height / 2 - self.preImageView.frame.size.height / 2);
+    
+    self.preImageView.frame = frame;
+}
+
+@end

+ 1 - 1
PDFViewer/View/CPDFBackgroundSettingView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFBackgroundSettingView : UIView
+@interface PDFBackgroundSettingView : UIView
 
 @property (nonatomic,strong) UILabel *titleLabel;
 @property (nonatomic,strong) UISlider *scaleSlider;

+ 2 - 2
PDFViewer/View/CPDFBackgroundSettingView.m

@@ -5,10 +5,10 @@
 //  Created by kdanmobile_2 on 2023/1/2.
 //
 
-#import "CPDFBackgroundSettingView.h"
+#import "PDFBackgroundSettingView.h"
 #import "Masonry.h"
 
-@implementation CPDFBackgroundSettingView
+@implementation PDFBackgroundSettingView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];

+ 1 - 1
PDFViewer/View/CPDFBackgroundView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFBackgroundView : UIView
+@interface PDFBackgroundView : UIView
 
 @property (nonatomic,strong) UIButton *colorBtn;
 @property (nonatomic,strong) UILabel *colorLabel;

+ 3 - 3
PDFViewer/View/CPDFBackgroundView.m

@@ -8,10 +8,10 @@
 #define KBUTTON_WIDTH 28
 #define KBUTTON_HEIGHT 28
 
-#import "CPDFBackgroundView.h"
+#import "PDFBackgroundView.h"
 #import "Masonry.h"
 
-@implementation CPDFBackgroundView
+@implementation PDFBackgroundView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
@@ -40,7 +40,7 @@
 - (void)drawRect:(CGRect)rect {
     [super drawRect:rect];
     
-    _colorLabel.frame = CGRectMake(20, 5, 50, 30);
+    _colorLabel.frame = CGRectMake(10, 5, 50, 30);
     _colorLabel.text = @"Color";
     _imageLabel.frame = CGRectMake(20, 40, 140, 30);
     _imageLabel.text = @"Image";

+ 18 - 0
PDFViewer/View/PDFClipView.h

@@ -0,0 +1,18 @@
+//
+//  CPDFClipView.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2022/12/23.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFClipView : UIView
+
+@property (nonatomic,assign) CGRect documentRect;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 5 - 3
PDFViewer/View/CPDFClipView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2022/12/23.
 //
 
-#import "CPDFClipView.h"
+#import "PDFClipView.h"
 
-@implementation CPDFClipView
+@implementation PDFClipView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
@@ -24,7 +24,9 @@
     
     CGContextRef context = UIGraphicsGetCurrentContext();
     
-    [self.delegate clipText:context];
+    CGContextSetFillColorWithColor(context, [UIColor systemGray5Color].CGColor);
+    CGContextFillRect(context, self.frame);
+    CGContextClearRect(context,_documentRect);
 }
 
 @end

+ 3 - 3
PDFViewer/View/CPDFDrawBackgroundView.h

@@ -6,13 +6,13 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "CPDFBackgroundModel.h"
+#import "PDFBackgroundModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFDrawBackgroundView : UIView
+@interface PDFDrawBackgroundView : UIView
 
-@property (nonatomic,strong) CPDFBackgroundModel *dataModel;
+@property (nonatomic,strong) PDFBackgroundModel *dataModel;
 
 @end
 

+ 2 - 2
PDFViewer/View/CPDFDrawBackgroundView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2023/1/3.
 //
 
-#import "CPDFDrawBackgroundView.h"
+#import "PDFDrawBackgroundView.h"
 
-@implementation CPDFDrawBackgroundView
+@implementation PDFDrawBackgroundView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];

+ 1 - 1
PDFViewer/View/CPDFDrawImageView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFDrawImageView : UIView
+@interface PDFDrawImageView : UIView
 
 @property (nonatomic,strong) UIImage *image;
 

+ 2 - 2
PDFViewer/View/CPDFDrawImageView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2023/1/3.
 //
 
-#import "CPDFDrawImageView.h"
+#import "PDFDrawImageView.h"
 
-@implementation CPDFDrawImageView
+@implementation PDFDrawImageView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];

+ 3 - 3
PDFViewer/View/CPDFDrawView.h

@@ -6,13 +6,13 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "CPDFDataModel.h"
+#import "PDFDataModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFDrawView : UIView
+@interface PDFDrawView : UIView
 
-@property (nonatomic,strong) CPDFDataModel *dataModel;
+@property (nonatomic,strong) PDFDataModel *dataModel;
 @property (nonatomic,assign) CGRect waterLabelRect;
 @property (nonatomic,assign) CGRect documentViewRect;
 @property (nonatomic,assign) CGFloat vertical;

+ 3 - 3
PDFViewer/View/CPDFDrawView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2022/12/22.
 //
 
-#import "CPDFDrawView.h"
+#import "PDFDrawView.h"
 
-@implementation CPDFDrawView
+@implementation PDFDrawView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
@@ -15,7 +15,7 @@
     if (self) {
         self.backgroundColor = [UIColor clearColor];
         
-        _dataModel = [[CPDFDataModel alloc] init];
+        _dataModel = [[PDFDataModel alloc] init];
         
         _horizontal = 100;
         _vertical = 100;

+ 2 - 3
PDFViewer/View/CPDFImagePreview.h

@@ -6,14 +6,13 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "PDFPreView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFImagePreview : UIView
+@interface PDFImagePreview : PDFPreView
 
-@property (nonatomic,strong) UIImageView *watermarkView;
 @property (nonatomic,strong) UIButton *rotationBtn;
-@property (nonatomic,strong) UIImageView *documentView;
 @property (nonatomic,assign) CGRect watermarkFrame;
 
 @end

+ 56 - 0
PDFViewer/View/PDFImagePreview.m

@@ -0,0 +1,56 @@
+//
+//  CPDFImagePreview.m
+//  PDFViewer
+//
+//  Created by kdan on 2022/11/18.
+//
+
+#import "PDFImagePreview.h"
+#import "Masonry.h"
+
+BOOL gImagePreviewIsFirstLayout = YES;
+
+@implementation PDFImagePreview
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        _rotationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+       
+        [self.documentView addSubview:self.preImageView];
+        [self.preImageView addSubview:_rotationBtn];
+    }
+    return self;
+}
+
+#pragma mark - Layout
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+    self.preImageView.layer.borderColor = UIColor.blueColor.CGColor;
+    self.preImageView.layer.borderWidth = 1;
+    [self.preImageView sizeToFit];
+    self.preImageView.contentMode = UIViewContentModeScaleAspectFit;
+    
+    CGRect frame = self.preImageView.frame;
+    frame.origin = CGPointMake(self.documentView.bounds.size.width / 2 - self.preImageView.frame.size.width / 2, self.documentView.bounds.size.height / 2 - self.preImageView.frame.size.height / 2);
+    _watermarkFrame = frame;
+    
+    self.preImageView.frame = _watermarkFrame;
+    
+    [_rotationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.preImageView.mas_bottom).offset(-10);
+        make.width.equalTo(@20);
+        make.height.equalTo(@20);
+        make.left.equalTo(self.preImageView.mas_right).offset(-10);
+    }];
+    
+    _rotationBtn.layer.cornerRadius = 10;
+    _rotationBtn.layer.masksToBounds = YES;
+    _rotationBtn.layer.borderColor = UIColor.blueColor.CGColor;
+    [_rotationBtn setBackgroundImage:[UIImage imageNamed:@"btn_selected"] forState:UIControlStateNormal];
+    
+}
+
+@end

+ 1 - 5
PDFViewer/View/CPDFImageView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFImageView : UIView
+@interface PDFImageView : UIView
 
 @property (nonatomic,strong) UIButton *selectBtn;
 @property (nonatomic,strong) UISlider *imageScaleSlider;
@@ -26,10 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic,strong) UILabel *imageLabel;
 @property (nonatomic,strong) UIButton *pageBtn;
 
-- (void)createView;
-- (void)createFrame;
-- (void)assignData;
-
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 2
PDFViewer/View/CPDFImageView.m

@@ -5,10 +5,10 @@
 //  Created by kdan on 2022/11/16.
 //
 
-#import "CPDFImageView.h"
+#import "PDFImageView.h"
 #import "Masonry.h"
 
-@implementation CPDFImageView
+@implementation PDFImageView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     

+ 20 - 0
PDFViewer/View/PDFPreView.h

@@ -0,0 +1,20 @@
+//
+//  CPDFPreView.h
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/12.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PDFPreView : UIView
+
+@property (nonatomic,strong) UIImageView *documentView;
+@property (nonatomic,strong) UILabel *preLabel;
+@property (nonatomic,strong) UIImageView *preImageView;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 31 - 0
PDFViewer/View/PDFPreView.m

@@ -0,0 +1,31 @@
+//
+//  CPDFPreView.m
+//  PDFViewer
+//
+//  Created by kdanmobile_2 on 2023/1/12.
+//
+
+#import "PDFPreView.h"
+
+@implementation PDFPreView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    
+    if (self = [super initWithFrame:frame]) {
+        _documentView = [[UIImageView alloc] init];
+        
+        CALayer *layer = [_documentView layer];
+        layer.borderColor = [[UIColor blackColor] CGColor];
+        layer.borderWidth = 0.2f;
+        
+        _preLabel = [[UILabel alloc] init];
+        
+        _preImageView = [[UIImageView alloc] init];
+        
+        [self addSubview:_documentView];
+    }
+    
+    return self;
+}
+
+@end

+ 2 - 3
PDFViewer/View/CPDFTextPreview.h

@@ -6,14 +6,13 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "PDFPreView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFTextPreview : UIView 
+@interface PDFTextPreview : PDFPreView
 
-@property (nonatomic,strong) UILabel *watermarkLabel;
 @property (nonatomic,strong) UIButton *rotationBtn;
-@property (nonatomic,strong) UIImageView *documentView;
 
 @end
 

+ 13 - 15
PDFViewer/View/CPDFTextPreview.m

@@ -5,23 +5,21 @@
 //  Created by kdan on 2022/11/18.
 //
 
-#import "CPDFTextPreview.h"
+#import "PDFTextPreview.h"
 #import "Masonry.h"
 
 BOOL gTextPreviewIsFirstLayout = YES;
 
-@implementation CPDFTextPreview
+@implementation PDFTextPreview
 
 - (instancetype)initWithFrame:(CGRect)frame
 {
     if (self = [super initWithFrame:frame]) {
-        _watermarkLabel = [[UILabel alloc] init];
+        
         _rotationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        _documentView = [[UIImageView alloc] init];
         
-        [self addSubview:_documentView];
-        [_documentView addSubview:_watermarkLabel];
-        [_watermarkLabel addSubview:_rotationBtn];
+        [self.documentView addSubview:self.preLabel];
+        [self.preLabel addSubview:_rotationBtn];
         
         self.backgroundColor = [UIColor systemGray5Color];
     }
@@ -33,10 +31,10 @@ BOOL gTextPreviewIsFirstLayout = YES;
 - (void)drawRect:(CGRect)rect {
     [super drawRect:rect];
 
-    _watermarkLabel.layer.borderWidth = 1;
-    _watermarkLabel.layer.borderColor = UIColor.blueColor.CGColor;
+    self.preLabel.layer.borderWidth = 1;
+    self.preLabel.layer.borderColor = UIColor.blueColor.CGColor;
 
-    [_watermarkLabel sizeToFit];
+    [self.preLabel sizeToFit];
     
     /*
      this have a core was delete:
@@ -46,9 +44,9 @@ BOOL gTextPreviewIsFirstLayout = YES;
      
      */
 
-    CGRect frame = _watermarkLabel.frame;
-    frame.origin = CGPointMake(_documentView.bounds.size.width / 2 - _watermarkLabel.frame.size.width / 2, _documentView.bounds.size.height / 2 - _watermarkLabel.frame.size.height / 2);
-        _watermarkLabel.frame = frame;
+    CGRect frame = self.preLabel.frame;
+    frame.origin = CGPointMake(self.documentView.bounds.size.width / 2 - self.preLabel.frame.size.width / 2, self.documentView.bounds.size.height / 2 - self.preLabel.frame.size.height / 2);
+    self.preLabel.frame = frame;
 
     _rotationBtn.layer.cornerRadius = 10;
     _rotationBtn.layer.masksToBounds = YES;
@@ -56,10 +54,10 @@ BOOL gTextPreviewIsFirstLayout = YES;
     [_rotationBtn setBackgroundImage:[UIImage imageNamed:@"btn_selected"] forState:UIControlStateNormal];
     
     [_rotationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(_watermarkLabel.mas_bottom).offset(-15);
+        make.top.equalTo(self.preLabel.mas_bottom).offset(-15);
         make.width.equalTo(@30);
         make.height.equalTo(@30);
-        make.left.equalTo(_watermarkLabel.mas_right).offset(-15);
+        make.left.equalTo(self.preLabel.mas_right).offset(-15);
     }];
 }
 

+ 1 - 6
PDFViewer/View/CPDFTextView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFTextView : UIView
+@interface PDFTextView : UIView
 
 @property (nonatomic,strong) UIButton *colorBtn;
 @property (nonatomic,strong) UILabel *colorLabel;
@@ -25,13 +25,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic,strong) UILabel *verticalLabel;
 @property (nonatomic,strong) UILabel *horizontalLabel;
 @property (nonatomic,strong) UIButton *pageBtn;
-
 @property (nonatomic,strong) NSMutableArray *colorArray;
 
-- (void)createView;
-- (void)createFrame;
-- (void)assignData;
-
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 2
PDFViewer/View/CPDFTextView.m

@@ -5,13 +5,13 @@
 //  Created by kdan on 2022/11/16.
 //
 
-#import "CPDFTextView.h"
+#import "PDFTextView.h"
 #import "Masonry.h"
 
 #define KBUTTON_WIDTH 28
 #define KBUTTON_HEIGHT 28
 
-@implementation CPDFTextView
+@implementation PDFTextView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     

+ 1 - 1
PDFViewer/View/CPDFEditView.h

@@ -9,7 +9,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface CPDFEditView : UIView
+@interface PDFEditView : UIView
  
 @property (nonatomic,strong) UITableView *editTableView;
 

+ 2 - 2
PDFViewer/View/CPDFEditView.m

@@ -5,9 +5,9 @@
 //  Created by kdanmobile_2 on 2022/12/26.
 //
 
-#import "CPDFEditView.h"
+#import "PDFEditView.h"
 
-@implementation CPDFEditView
+@implementation PDFEditView
 
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];