├── .swift-version
├── pdfxkit.png
├── PDFs
└── PSPDFKit.11.QuickStart.Guide.pdf
├── Example
├── PDFXKitExample
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── PDFXKitExample-Bridging-Header.h
│ ├── PDFXKitExample.entitlements
│ ├── AppController.swift
│ ├── MainController.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ └── Info.plist
└── PDFXKitExample.xcodeproj
│ └── xcshareddata
│ └── xcschemes
│ └── PDFXKitExample.xcscheme
├── PDFXKit.xcworkspace
├── xcshareddata
│ ├── IDEWorkspaceChecks.plist
│ └── swiftpm
│ │ └── Package.resolved
└── contents.xcworkspacedata
├── .gitattributes
├── Sources
├── PDFXKitObjC
│ ├── Private
│ │ ├── PSPDFKit+PDFXKit.h
│ │ ├── PDFXPage+PSPDFKit.h
│ │ ├── PDFXAction+PSPDFKit.h
│ │ ├── PDFXBorder+PSPDFKit.h
│ │ ├── PDFXActionURL+PSPDFKit.h
│ │ ├── PDFXActionGoTo+PSPDFKit.h
│ │ ├── PDFXActionNamed+PSPDFKit.h
│ │ ├── PDFXAnnotation+PSPDFKit.h
│ │ ├── PDFXDestination+PSPDFKit.h
│ │ ├── PDFXActionRemoteGoTo+PSPDFKit.h
│ │ ├── PDFXActionResetForm+PSPDFKit.h
│ │ ├── PDFXAnnotationPopup+PSPDFKit.h
│ │ ├── PDFXAppearanceCharacteristics+PSPDFKit.h
│ │ ├── PDFXPlatform+Private.h
│ │ ├── PDFXPage+Private.h
│ │ ├── PDFXThumbnailView+PSPDFKit.h
│ │ ├── PDFXView+PSPDFKit.h
│ │ ├── PDFXDocument+PSPDFKit.h
│ │ ├── PDFXSelection+Private.h
│ │ ├── PDFXOutline+PSPDFKit.h
│ │ ├── PDFXKit+PSPDFKit.h
│ │ └── PDFXSelection+PSPDFKit.h
│ ├── Public
│ │ ├── PDFXPage+Swift.h
│ │ ├── PDFXView+Swift.h
│ │ ├── PDFXAction+Swift.h
│ │ ├── PDFXBorder+Swift.h
│ │ ├── PDFXOutline+Swift.h
│ │ ├── PDFXActionURL+Swift.h
│ │ ├── PDFXSelection+Swift.h
│ │ ├── PDFXActionGoTo+Swift.h
│ │ ├── PDFXActionNamed+Swift.h
│ │ ├── PDFXAnnotation+Swift.h
│ │ ├── PDFXDestination+Swift.h
│ │ ├── PDFXAnnotationPopup.h
│ │ ├── PDFXThumbnailView+Swift.h
│ │ ├── PDFXActionRemoteGoTo+Swift.h
│ │ ├── PDFXActionResetForm+Swift.h
│ │ ├── PDFXAnnotationPopup+Swift.h
│ │ ├── PDFXAppearanceCharacteristics+Swift.h
│ │ ├── PDFXAction.h
│ │ ├── PDFXActionURL.h
│ │ ├── PDFXActionResetForm.h
│ │ ├── PDFXViewDelegate.h
│ │ ├── PDFXActionGoTo.h
│ │ ├── PDFXKit+Swift.h
│ │ ├── PDFXActionRemoteGoTo.h
│ │ ├── PDFXDestination.h
│ │ ├── PDFXDocumentDelegate.h
│ │ ├── PDFXActionNamed.h
│ │ ├── PDFXDocument+Swift.h
│ │ ├── PDFXThumbnailView.h
│ │ ├── PDFXBorder.h
│ │ ├── PDFXPlatform.h
│ │ ├── PDFXOutline.h
│ │ ├── PDFXAppearanceCharacteristics.h
│ │ ├── PDFXSelection.h
│ │ ├── PDFXKit.h
│ │ ├── PDFXCompatibility.h
│ │ ├── PDFXPage.h
│ │ ├── PDFXDocument.h
│ │ ├── PDFXView.h
│ │ └── PDFXAnnotation.h
│ └── ObjC
│ │ ├── PDFXAnnotationPopup.m
│ │ ├── PDFXActionURL.m
│ │ ├── PDFXActionNamed.m
│ │ ├── PDFXActionGoTo.m
│ │ ├── PDFXActionResetForm.m
│ │ ├── PDFXAction.m
│ │ ├── PDFXActionRemoteGoTo.m
│ │ ├── PDFXBorder.m
│ │ ├── PDFXAppearanceCharacteristics.m
│ │ ├── PDFXDestination.m
│ │ ├── PDFXThumbnailView.m
│ │ ├── PDFXOutline.m
│ │ ├── PDFXSelection.m
│ │ ├── PDFXPage.m
│ │ ├── PDFXAnnotation.m
│ │ └── PDFXDocument.m
└── PDFXKit
│ └── PDFXCompatibility.swift
├── InfoPlists
├── PDFXKitTests-Info.plist
└── PDFXKit-Info.plist
├── Package.swift
├── .gitignore
├── PDFXKit.podspec
├── LICENSE.md
├── PDFXKit.xcodeproj
└── xcshareddata
│ └── xcschemes
│ └── PDFXKit.xcscheme
├── README.md
├── Rakefile
└── Tests
└── PDFXKitObjectiveCTests.m
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.2
2 |
--------------------------------------------------------------------------------
/pdfxkit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PSPDFKit/PDFXKit/HEAD/pdfxkit.png
--------------------------------------------------------------------------------
/PDFs/PSPDFKit.11.QuickStart.Guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PSPDFKit/PDFXKit/HEAD/PDFs/PSPDFKit.11.QuickStart.Guide.pdf
--------------------------------------------------------------------------------
/Example/PDFXKitExample/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/PDFXKitExample/PDFXKitExample-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/PDFXKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/PDFXKit.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.xib -whitespace
2 | *.nib -whitespace
3 | *.pdf -whitespace
4 | *.pbxproj -whitespace
5 | *Info.plist -whitespace
6 | *.storyboard -whitespace
7 |
8 | Frameworks/**/CodeResources -whitespace
9 | Frameworks/**/*.plist -whitespace
10 | Frameworks/**/*.h -whitespace
11 | Frameworks/**/*.md -whitespace
12 | Frameworks/**/*.stringsdict -whitespace
13 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PSPDFKit+PDFXKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | // TODO: add any PSPDFKit extensions here.
13 |
--------------------------------------------------------------------------------
/PDFXKit.xcworkspace/xcshareddata/swiftpm/Package.resolved:
--------------------------------------------------------------------------------
1 | {
2 | "object": {
3 | "pins": [
4 | {
5 | "package": "PSPDFKit",
6 | "repositoryURL": "https://github.com/PSPDFKit/PSPDFKit-SP",
7 | "state": {
8 | "branch": null,
9 | "revision": "3c715a701129dd221af159a2be310d58ee12009d",
10 | "version": "11.2.4"
11 | }
12 | }
13 | ]
14 | },
15 | "version": 1
16 | }
17 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXPage+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXPage.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXPage ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXAction+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAction.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXAction ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXBorder+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXBorder.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXBorder ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXActionURL+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionURL.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXActionURL ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXActionGoTo+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionGoTo.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXActionGoTo ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXActionNamed+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionNamed.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXActionNamed ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXAnnotation+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAnnotation.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXAnnotation ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXDestination+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXDestination.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXDestination ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXActionRemoteGoTo+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionRemoteGoTo.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXActionRemoteGoTo ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXActionResetForm+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionResetForm.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXActionResetForm ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXAnnotationPopup+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAnnotationPopup.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXAnnotationPopup ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXAppearanceCharacteristics+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAppearanceCharacteristics.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXAppearanceCharacteristics ()
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXPage+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPage.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXPage ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXView+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXView.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXView ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAction+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXAction.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAction ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXBorder+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXBorder.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXBorder ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXOutline+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXOutline.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXOutline ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXPlatform+Private.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXPlatform.h"
10 |
11 | #define var __auto_type
12 | #define let var const
13 |
14 | #define PDFXSwiftIndexFromObjCIndex(index) ((NSInteger)index)
15 | #define PDFXObjCIndexFromSwiftIndex(index) ((NSUInteger)index)
16 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionURL+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXActionURL.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXActionURL ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXSelection+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXSelection.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXSelection ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionGoTo+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXActionGoTo.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXActionGoTo ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionNamed+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXActionNamed.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXActionNamed ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAnnotation+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXAnnotation.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAnnotation ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXDestination+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXDestination.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXDestination ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAnnotationPopup.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAnnotationPopup : NSObject
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXThumbnailView+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXThumbnailView.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXThumbnailView ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionRemoteGoTo+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXActionRemoteGoTo.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXActionRemoteGoTo ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionResetForm+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXActionResetForm.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXActionResetForm ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAnnotationPopup+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXAnnotationPopup.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAnnotationPopup ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAppearanceCharacteristics+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXAppearanceCharacteristics.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAppearanceCharacteristics ()
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXAnnotationPopup.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAnnotationPopup+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXAnnotationPopup
14 |
15 | - (instancetype)init {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/PDFXKitExample.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.device.audio-input
8 |
9 | com.apple.security.device.camera
10 |
11 | com.apple.security.files.user-selected.read-write
12 |
13 | com.apple.security.network.client
14 |
15 | com.apple.security.print
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXPage+Private.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXPage.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXPage ()
14 |
15 | // This property is only allowed to be set by the document.
16 | @property (nonatomic, readwrite, weak, nullable) PDFXDocument *document;
17 | @property (nonatomic) NSUInteger index;
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAction.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXAction : NSObject
18 |
19 | @property (nonatomic, readonly) NSString *type PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXThumbnailView+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXThumbnailView.h"
10 | #import "PSPDFKit+PDFXKit.h"
11 | #import "PDFXPlatform.h"
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @class PSPDFScrubberBar;
16 |
17 | @interface PDFXThumbnailView ()
18 |
19 | @property (nonatomic, strong) PSPDFScrubberBar *pspdfScrubberBar;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXActionURL.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionURL+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXActionURL
14 |
15 | - (instancetype)initWithURL:(NSURL *)url {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic, copy) NSURL *URL;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXActionNamed.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionNamed+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXActionNamed
14 |
15 | - (instancetype)initWithName:(PDFXActionNamedName)name {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic) PDFXActionNamedName name;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXView+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXView.h"
10 | #import "PSPDFKit+PDFXKit.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface PDFXView ()
15 |
16 | @property (nonatomic, readonly) PSPDFViewController *pspdfViewController;
17 | @property (nonatomic, readonly) PSPDFDocument *pspdfDocument;
18 |
19 | - (PSPDFViewController *)makePSPDFViewController;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXActionGoTo.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionGoTo+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXActionGoTo
14 |
15 | - (instancetype)initWithDestination:(PDFXDestination *)destination {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic, strong) PDFXDestination *destination;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXDocument+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXDocument.h"
10 | #import "PSPDFKit+PDFXKit.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface PDFXDocument ()
15 |
16 | @property (nonatomic) PSPDFDocument *pspdfDocument;
17 | @property (nonatomic, nullable) PSPDFTextSearch *pspdfTextSearch;
18 |
19 | - (instancetype)initWithPSPDFDocument:(PSPDFDocument *)pspdfDocument NS_DESIGNATED_INITIALIZER;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXSelection+Private.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXSelection.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface PDFXSelection ()
14 |
15 | /**
16 | Quick & dirty init method to create a simple selection for displaying search
17 | results. Will be revised soonish.
18 | */
19 | - (instancetype)initWithDocument:(PDFXDocument *)document page:(nullable PDFXPage *)page range:(NSRange)range string:(nullable NSString *)string;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXActionResetForm.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionResetForm+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXActionResetForm
14 |
15 | - (instancetype)init {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic, copy, nullable) NSArray *fields;
23 | // @property (nonatomic) BOOL fieldsIncludedAreCleared;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXOutline+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXOutline.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @class PSPDFOutlineElement;
14 |
15 | @interface PDFXOutline ()
16 |
17 | @property (nonatomic, strong) PSPDFOutlineElement *pspdfOutlineElement;
18 |
19 | - (instancetype)initWithPSPDFOutlineElement:(PSPDFOutlineElement *)pspdfOutlineElement index:(NSUInteger)index parent:(nullable PDFXOutline *)parent document:(PDFXDocument *)document;
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionURL.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAction.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @interface PDFXActionURL : PDFXAction
20 |
21 | - (instancetype)initWithURL:(NSURL *)url PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
22 |
23 | @property (nonatomic, copy) NSURL *URL PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
24 |
25 | @end
26 |
27 | NS_ASSUME_NONNULL_END
28 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXAction.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAction+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXAction
14 |
15 | - (instancetype)init {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic, readonly) NSString *type;
23 |
24 | #pragma mark - NSCopying
25 |
26 | - (id)copyWithZone:(NSZone *)zone {
27 | // TODO: implement.
28 | return [self.class new];
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/InfoPlists/PDFXKitTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionResetForm.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAction.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @interface PDFXActionResetForm : PDFXAction
20 |
21 | @property (nonatomic, copy, nullable) NSArray *fields PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
22 | @property (nonatomic) BOOL fieldsIncludedAreCleared PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
23 |
24 | @end
25 |
26 | NS_ASSUME_NONNULL_END
27 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXViewDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | @class PDFXView;
16 | @class PDFXActionRemoteGoTo;
17 |
18 | @protocol PDFXViewDelegate
19 |
20 | @optional
21 |
22 | - (void)PDFXViewOpenPDF:(PDFXView *)sender forRemoteGoToAction:(PDFXActionRemoteGoTo *)action;
23 | - (void)PDFXViewPerformFind:(PDFXView *)sender;
24 | - (void)PDFXViewPerformGoToPage:(PDFXView *)sender;
25 | - (void)PDFXViewWillClickOnLink:(PDFXView *)sender withURL:(NSURL *)url;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXActionRemoteGoTo.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXActionRemoteGoTo+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | @implementation PDFXActionRemoteGoTo
14 |
15 | - (instancetype)initWithPageIndex:(NSUInteger)pageIndex atPoint:(PDFXPoint)point fileURL:(NSURL *)url {
16 | if ((self = [super init])) {
17 | // TODO: implement.
18 | }
19 | return self;
20 | }
21 |
22 | // @property (nonatomic) NSUInteger pageIndex;
23 | // @property (nonatomic) PDFXPoint point;
24 | // @property (nonatomic, copy) NSURL *URL;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionGoTo.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAction.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class PDFXDestination;
20 |
21 | @interface PDFXActionGoTo : PDFXAction
22 |
23 | - (instancetype)initWithDestination:(PDFXDestination *)destination PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
24 |
25 | @property (nonatomic, strong) PDFXDestination *destination PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/InfoPlists/PDFXKit-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXKit+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAction+Swift.h"
10 | #import "PDFXActionGoTo+Swift.h"
11 | #import "PDFXActionNamed+Swift.h"
12 | #import "PDFXActionResetForm+Swift.h"
13 | #import "PDFXActionRemoteGoTo+Swift.h"
14 | #import "PDFXActionURL+Swift.h"
15 | #import "PDFXAnnotation+Swift.h"
16 | #import "PDFXAnnotationPopup+Swift.h"
17 | #import "PDFXAppearanceCharacteristics+Swift.h"
18 | #import "PDFXBorder+Swift.h"
19 | #import "PDFXDestination+Swift.h"
20 | #import "PDFXDocument+Swift.h"
21 | #import "PDFXOutline+Swift.h"
22 | #import "PDFXPage+Swift.h"
23 | #import "PDFXSelection+Swift.h"
24 | #import "PDFXThumbnailView+Swift.h"
25 | #import "PDFXView+Swift.h"
26 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/AppController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | import UIKit
10 | import PSPDFKit
11 |
12 | @UIApplicationMain
13 | class AppController: UIResponder, UIApplicationDelegate {
14 | var window: UIWindow?
15 |
16 | public func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
17 | // Set your license key here. PSPDFKit is commercial software.
18 | // Each PSPDFKit license is bound to a specific app bundle id.
19 | // Visit https://customers.pspdfkit.com to get your demo or commercial license key.
20 | SDK.setLicenseKey("YOUR_LICENSE_KEY_GOES_HERE")
21 | return true;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXKit+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAction+PSPDFKit.h"
10 | #import "PDFXActionGoTo+PSPDFKit.h"
11 | #import "PDFXActionNamed+PSPDFKit.h"
12 | #import "PDFXActionResetForm+PSPDFKit.h"
13 | #import "PDFXActionRemoteGoTo+PSPDFKit.h"
14 | #import "PDFXActionURL+PSPDFKit.h"
15 | #import "PDFXAnnotation+PSPDFKit.h"
16 | #import "PDFXAnnotationPopup+PSPDFKit.h"
17 | #import "PDFXAppearanceCharacteristics+PSPDFKit.h"
18 | #import "PDFXBorder+PSPDFKit.h"
19 | #import "PDFXDestination+PSPDFKit.h"
20 | #import "PDFXDocument+PSPDFKit.h"
21 | #import "PDFXOutline+PSPDFKit.h"
22 | #import "PDFXPage+PSPDFKit.h"
23 | #import "PDFXSelection+PSPDFKit.h"
24 | #import "PDFXThumbnailView+PSPDFKit.h"
25 | #import "PDFXView+PSPDFKit.h"
26 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Private/PDFXSelection+PSPDFKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXSelection.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @class PSPDFSearchResult;
14 |
15 | @interface PDFXSelection ()
16 |
17 | /**
18 | Only set if the selection was created from a PSPDF search result, otherwise
19 | this property is `nil`.
20 | */
21 | @property (nonatomic, nullable) PSPDFSearchResult *pspdfSearchResult;
22 |
23 | /**
24 | Use this to create selections from search results, the search result is then
25 | retained and accessed for PSDPFKit interoperability.
26 | */
27 | - (nullable instancetype)initWithDocument:(PDFXDocument *)document PSPDFSearchResult:(PSPDFSearchResult *)pspdfSearchResult;
28 |
29 | @end
30 |
31 | NS_ASSUME_NONNULL_END
32 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionRemoteGoTo.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAction.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @interface PDFXActionRemoteGoTo : PDFXAction
20 |
21 | - (instancetype)initWithPageIndex:(NSUInteger)pageIndex atPoint:(PDFXPoint)point fileURL:(NSURL *)url PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
22 |
23 | @property (nonatomic) NSUInteger pageIndex PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
24 | @property (nonatomic) PDFXPoint point PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
25 | @property (nonatomic, copy) NSURL *URL PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
26 |
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXDestination.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class PDFXPage;
18 |
19 | PDFX_EXTERN CGFloat const kPDFXDestinationUnspecifiedValue;
20 |
21 | @interface PDFXDestination : NSObject
22 |
23 | /// @name Initializing a Destination
24 |
25 | - (instancetype)initWithPage:(PDFXPage *)page atPoint:(PDFXPoint)point;
26 |
27 | /// @name Getting Pages and Points
28 |
29 | @property (nonatomic, weak, readonly) PDFXPage *page;
30 | @property (nonatomic, readonly) PDFXPoint point;
31 |
32 | /// @name Zooming
33 |
34 | @property (nonatomic) CGFloat zoom;
35 |
36 | /// @name Comparing Destinations
37 |
38 | - (NSComparisonResult)compare:(PDFXDestination *)destination;
39 |
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.5
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 | import PackageDescription
4 |
5 | let package = Package(
6 | name: "PDFXKit",
7 | platforms: [
8 | .iOS(.v13)
9 | ],
10 | products: [
11 | .library(
12 | name: "PDFXKit",
13 | targets: ["PDFXKit"]),
14 | ],
15 | dependencies: [
16 | .package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", from: "11.2.4"),
17 | ],
18 | targets: [
19 | .target(
20 | name: "PDFXKitObjC",
21 | dependencies: [
22 | .product(name: "PSPDFKit", package: "PSPDFKit-SP")
23 | ],
24 | path: "Sources/PDFXKitObjC",
25 | publicHeadersPath: "Public",
26 | cSettings: [
27 | .headerSearchPath("Private")
28 | ]
29 | ),
30 | .target(
31 | name: "PDFXKit",
32 | dependencies: ["PDFXKitObjC"],
33 | path: "Sources/PDFXKit"),
34 | .testTarget(
35 | name: "PDFXKitTests",
36 | dependencies: ["PDFXKit"],
37 | path: "Tests")
38 | ]
39 | )
40 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXDocumentDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | @class PDFXDocument;
16 | @class PDFXSelection;
17 |
18 | @protocol PDFXDocumentDelegate
19 |
20 | @optional
21 |
22 | #pragma mark - General Notifications
23 |
24 | - (void)documentDidUnlock:(NSNotification *)notification;
25 | - (void)documentDidBeginDocumentFind:(NSNotification *)notification;
26 | - (void)documentDidEndDocumentFind:(NSNotification *)notification;
27 | - (void)documentDidBeginPageFind:(NSNotification *)notification;
28 | - (void)documentDidEndPageFind:(NSNotification *)notification;
29 | - (void)documentDidFindMatch:(NSNotification *)notification;
30 |
31 | #pragma mark - Search Notifications
32 |
33 | - (void)didMatchString:(PDFXSelection *)instance;
34 |
35 | #pragma mark - Customizing Classes
36 |
37 | - (Class)classForPage;
38 | - (Class)classForAnnotationType:(NSString *)annotationType;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/MainController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2022 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | import UIKit
10 | import PDFXKit
11 |
12 | class MainController: UIViewController {
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 |
16 | pdfView.translatesAutoresizingMaskIntoConstraints = false
17 | view.addSubview(pdfView)
18 |
19 | pdfView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
20 | pdfView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
21 | pdfView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
22 | pdfView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
23 |
24 | let sampleDocumentURL = Bundle.main.url(forResource: "PSPDFKit.11.QuickStart.Guide", withExtension: "pdf", subdirectory: "PDFs")!
25 | let sampleDocument = PDFDocument(url: sampleDocumentURL)
26 |
27 | pdfView.document = sampleDocument
28 | }
29 |
30 | // MARK: - Outlets
31 |
32 | private var pdfView = PDFView()
33 | }
34 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXActionNamed.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAction.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | typedef NS_ENUM(NSInteger, PDFXActionNamedName) {
20 | kPDFXActionNamedNone = 0,
21 | kPDFXActionNamedNextPage = 1,
22 | kPDFXActionNamedPreviousPage = 2,
23 | kPDFXActionNamedFirstPage = 3,
24 | kPDFXActionNamedLastPage = 4,
25 | kPDFXActionNamedGoBack = 5,
26 | kPDFXActionNamedGoForward = 6,
27 | kPDFXActionNamedGoToPage = 7,
28 | kPDFXActionNamedFind = 8,
29 | kPDFXActionNamedPrint = 9,
30 | kPDFXActionNamedZoomIn = 10,
31 | kPDFXActionNamedZoomOut = 11
32 | };
33 |
34 | @interface PDFXActionNamed : PDFXAction
35 |
36 | - (instancetype)initWithName:(PDFXActionNamedName)name PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
37 |
38 | @property (nonatomic) PDFXActionNamedName name PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
39 |
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | */build
3 | *.pbxuser
4 | !default.pbxuser
5 | *.mode1v3
6 | !default.mode1v3
7 | *.mode2v3
8 | !default.mode2v3
9 | *.perspectivev3
10 | !default.perspectivev3
11 | xcuserdata
12 | profile
13 | *.moved-aside
14 | project.xcworkspace
15 | *.xccheckout
16 | *.xcscmblueprint
17 |
18 | # osx noise
19 | .DS_Store
20 | profile
21 |
22 | build
23 | Build
24 | Logs
25 | CoreSimulator-Logs
26 | DTXConnection-Logs
27 | Builds
28 | Development
29 | Releases
30 | Products
31 | artifacts
32 | documentation/
33 |
34 | # automated git versioning
35 | InfoPlist.h
36 |
37 | .Rakeconfig
38 | .Rakeconfig.staging
39 | .bundle/*
40 | !.bundle/config
41 |
42 | # ignore static libraries
43 | !Extras/SQLCipher/binaries/*.a
44 |
45 | # Address sanitizer
46 | *.gcda
47 | *.gcno
48 |
49 | # jenkins output
50 | xcodebuild.txt
51 |
52 | *.dSYM
53 |
54 | #jazzy
55 | jazzy-docs/build
56 | jazzy-docs/docs
57 |
58 | # fastlane
59 | fastlane/README.md
60 | fastlane/report.xml
61 |
62 | # Slather coverage
63 | slather-report
64 |
65 | # Ruby coverage
66 | coverage
67 |
68 | # Ruby documentation
69 | /doc/
70 | /.yardoc
71 |
72 | # Test snapshots
73 | TestSnapshots
74 |
75 | # Swift Package Manager
76 | .swiftpm
77 | .swiftpm/config/registries.json
78 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
79 | Package.resolved
80 | /Packages
81 | DerivedData/
82 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXDocument+Swift.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXDocument.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @interface PDFXDocument ()
18 |
19 | @property (nonatomic, readonly) NSInteger __swiftPageCount NS_SWIFT_NAME(pageCount);
20 | - (nullable PDFXPage *)__swiftPageAtIndex:(NSInteger)index NS_SWIFT_NAME(page(at:));
21 | - (NSInteger)__swiftIndexForPage:(PDFXPage *)page NS_SWIFT_NAME(index(for:));
22 |
23 | - (void)__swiftInsertPage:(PDFXPage *)page atIndex:(NSInteger)index NS_SWIFT_NAME(insert(_:at:));
24 | - (void)__swiftRemovePageAtIndex:(NSInteger)index NS_SWIFT_NAME(removePage(at:));
25 | - (void)__swiftExchangePageAtIndex:(NSInteger)indexOfPageToReplace withPageAtIndex:(NSInteger)indexOfReplacementPage NS_SWIFT_NAME(exchangePage(at:withPageAt:));
26 |
27 | - (nullable PDFXSelection *)__swiftSelectionFromPage:(PDFXPage *)startPage atCharacterIndex:(NSInteger)startCharacter toPage:(PDFXPage *)endPage atCharacterIndex:(NSUInteger)endCharacter NS_SWIFT_NAME(selection(from:at:to:at:));
28 |
29 | @end
30 |
31 | NS_ASSUME_NONNULL_END
32 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXThumbnailView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class PDFXPage;
18 | @class PDFXView;
19 |
20 | typedef NS_ENUM(NSInteger, PDFXThumbnailLayoutMode) {
21 | PDFXThumbnailLayoutModeVertical = 0,
22 | PDFXThumbnailLayoutModeHorizontal = 1
23 | };
24 |
25 | PDFX_EXTERN NSNotificationName const PDFXThumbnailViewDocumentEditedNotification;
26 |
27 | @interface PDFXThumbnailView : PDFXPlatformView
28 |
29 | @property (nonatomic, strong, nullable) PDFXView *PDFView PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
30 |
31 | @property (nonatomic) PDFXSize thumbnailSize PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
32 | @property (nonatomic, copy, nullable) PDFXColor *backgroundColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
33 |
34 | @property (nonatomic) PDFXThumbnailLayoutMode layoutMode PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
35 | @property (nonatomic) PDFXEdgeInsets contentInset PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
36 |
37 | @property (nonatomic, readonly, strong, nullable) NSArray *selectedPages PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
38 |
39 | @end
40 |
41 | NS_ASSUME_NONNULL_END
42 |
--------------------------------------------------------------------------------
/PDFXKit.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | #
4 | # The PDFXKit is licensed with a modified BSD license. Please see License for
5 | # details. This notice may not be removed from this file.
6 | #
7 |
8 | Pod::Spec.new do |spec|
9 | spec.name = "PDFXKit"
10 | spec.version = "0.1.0"
11 | spec.summary = "Apple PDFKit source-compatible wrapper for PSPDFKit."
12 | spec.documentation_url = 'https://pspdfkit.com/guides/ios/current/migration-guides/migrating-from-apple-pdfkit/'
13 |
14 | spec.description = """
15 | PDFXKit is a drop-in replacement giving you the same API as PDFKit while
16 | using PSPDFKit under the hood — only a few tweaks required. PDFXKit gives
17 | you full access to the underlying PSPDFKit allowing you take take advantage
18 | of all PSPDFKit features, components, and tools if and when you need them.
19 | """
20 |
21 | spec.homepage = "http://github.com/PSPDFKit/PDFXKit"
22 | spec.license = { :type => "BSD (modified)", :file => "LICENSE.md" }
23 |
24 | spec.author = { "PSPDFKit GmbH" => "info@pspdfkit.com" }
25 | spec..social_media_url = "http://twitter.com/pspdfkit"
26 |
27 | spec.platform = :ios, "12.0"
28 | spec.ios.deployment_target = "12.0"
29 |
30 | spec.source = { :git => "git@github.com:PSPDFKit/PDFXKit.git", :branch => "master" }
31 | spec.source_files = "Sources", "Sources/**/*.{h,m,swift}"
32 | spec.public_header_files = "Sources/**/*.h"
33 |
34 | spec.requires_arc = true
35 | spec.swift_version = '5.0'
36 | spec.frameworks = "PDFKit"
37 | spec.dependency "PSPDFKit"
38 | end
39 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXBorder.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | typedef NS_ENUM(NSInteger, PDFXBorderStyle) {
18 | kPDFXBorderStyleSolid = 0,
19 | kPDFXBorderStyleDashed = 1,
20 | kPDFXBorderStyleBeveled = 2,
21 | kPDFXBorderStyleInset = 3,
22 | kPDFXBorderStyleUnderline = 4
23 | };
24 |
25 | typedef NSString *const PDFXBorderKey NS_STRING_ENUM;
26 |
27 | PDFX_EXTERN PDFXBorderKey PDFXBorderKeyDashPattern;
28 | PDFX_EXTERN PDFXBorderKey PDFXBorderKeyLineWidth;
29 | PDFX_EXTERN PDFXBorderKey PDFXBorderKeyStyle;
30 |
31 | @interface PDFXBorder : NSObject
32 |
33 | /// @name Border Style and Characteristics
34 |
35 | @property (nonatomic) PDFXBorderStyle style PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
36 |
37 | @property (nonatomic) CGFloat lineWidth PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
38 | @property (nonatomic, copy, nullable) NSArray *dashPattern PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
39 |
40 | @property (nonatomic, readonly, copy) NSDictionary *borderKeyValues PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
41 |
42 | /// @name Drawing Borders
43 |
44 | - (void)drawInRect:(PDFXRect)rect PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
45 |
46 | @end
47 |
48 | NS_ASSUME_NONNULL_END
49 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXBorder.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXBorder+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | PDFXBorderKey PDFXBorderKeyDashPattern = @"D";
14 | PDFXBorderKey PDFXBorderKeyLineWidth = @"W";
15 | PDFXBorderKey PDFXBorderKeyStyle = @"S";
16 |
17 | @implementation PDFXBorder
18 |
19 | - (instancetype)init {
20 | if ((self = [super init])) {
21 | // TODO: implement.
22 | }
23 | return self;
24 | }
25 |
26 | #pragma mark - Border Style and Characteristics
27 |
28 | // @property (nonatomic) PDFXBorderStyle style;
29 |
30 | // @property (nonatomic) CGFloat lineWidth;
31 | // @property (nonatomic, copy, nullable) NSArray *dashPattern;
32 |
33 | - (NSDictionary *)borderKeyValues {
34 | // TODO: implement.
35 | return @{};
36 | }
37 |
38 | #pragma mark - Drawing Borders
39 |
40 | - (void)drawInRect:(PDFXRect)rect {
41 | // TODO: implement.
42 | }
43 |
44 | #pragma mark - NSCopying
45 |
46 | - (id)copyWithZone:(NSZone *)zone {
47 | // TODO: implement.
48 | return [self.class new];
49 | }
50 |
51 | #pragma mark - NSCoding
52 |
53 | - (void)encodeWithCoder:(nonnull NSCoder *)aCoder {
54 | // TODO: implement.
55 | }
56 |
57 | - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder {
58 | // TODO: implement.
59 | return nil;
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXPlatform.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import
10 |
11 | #define PDFX_API_WARNING(message) __attribute__((deprecated(message)))
12 | #define PDFX_OBJC_ONLY NS_SWIFT_UNAVAILABLE("Objective-C only, check corresponding Swift header (*+Swift.h).")
13 |
14 | #define PDFX_EXTERN extern
15 |
16 | #define PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN
17 | #define PDFX_NOT_IMPLEMENTED_PRIORITY_LOW
18 | #define PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM
19 | #define PDFX_NOT_IMPLEMENTED_PRIORITY_HIGH
20 |
21 | #define PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_UNKNOWN(...)
22 | #define PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_LOW(...)
23 | #define PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_MEDIUM(...)
24 | #define PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_HIGH(...)
25 |
26 | #define PDFXPlatformView UIView
27 |
28 | #define PDFXFont UIEvent
29 | #define PDFXColor UIColor
30 | #define PDFXImage UIImage
31 | #define PDFXEvent UIEvent
32 | #define PDFXBezierPath UIBezierPath
33 |
34 | #define PDFXEdgeInsets UIEdgeInsets
35 | #define PDFXEdgeInsetsZero UIEdgeInsetsZero
36 |
37 | #define PDFXPoint CGPoint
38 | #define PDFXPointZero CGPointZero
39 |
40 | #define PDFXSize CGSize
41 | #define PDFXSizeZero CGSizeZero
42 |
43 | #define PDFXRect CGRect
44 | #define PDFXRectZero CGRectZero
45 |
46 | #define PDFXAffineTransform CGAffineTransform
47 | #define PDFXAffineTransformZero CGAffineTransformZero
48 | #define PDFXAffineTransformIdentity CGAffineTransformIdentity
49 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXAppearanceCharacteristics.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAppearanceCharacteristics+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBackgroundColor = @"BG";
14 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBorderColor = @"BC";
15 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyCaption = @"CA";
16 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyDownCaption = @"AC";
17 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRolloverCaption = @"RC";
18 | PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRotation = @"R";
19 |
20 | @implementation PDFXAppearanceCharacteristics
21 |
22 | - (instancetype)init {
23 | if ((self = [super init])) {
24 | // TODO: implement.
25 | }
26 | return self;
27 | }
28 |
29 | // @property (nonatomic) PDFXWidgetControlType controlType;
30 | // @property (nonatomic, copy, nullable) PDFXColor *backgroundColor;
31 |
32 | // @property (nonatomic, copy, nullable) PDFXColor *borderColor;
33 | // @property (nonatomic) NSInteger rotation;
34 |
35 | // @property (nonatomic, copy, nullable) NSString *caption;
36 | // @property (nonatomic, copy, nullable) NSString *rolloverCaption;
37 |
38 | // @property (nonatomic, copy, nullable) NSString *downCaption;
39 | // @property (nonatomic, readonly, copy) NSDictionary *appearanceCharacteristicsKeyValues;
40 |
41 | #pragma mark - NSCopying
42 |
43 | - (id)copyWithZone:(NSZone *)zone {
44 | // TODO: implement.
45 | return [self.class new];
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXOutline.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class PDFXAction;
18 | @class PDFXDestination;
19 | @class PDFXDocument;
20 |
21 | @interface PDFXOutline : NSObject
22 |
23 | /// @name Initializing an Outline
24 |
25 | - (instancetype)init PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
26 |
27 | /// @name Getting Information About an Outline
28 |
29 | @property (nonatomic, readonly, weak, nullable) PDFXDocument *document;
30 | @property (nonatomic, readonly, nullable) PDFXOutline *parent;
31 |
32 | @property (nonatomic, readonly) NSUInteger numberOfChildren;
33 | - (PDFXOutline *)childAtIndex:(NSUInteger)index;
34 |
35 | @property (nonatomic, readonly) NSUInteger index;
36 |
37 | /// @name Managing Outline Labels
38 |
39 | @property (nonatomic, copy, nullable) NSString *label PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_UNKNOWN("Setting the label isn't supported yet.");
40 |
41 | /// @name Managing Actions and Destinations
42 |
43 | @property (nonatomic, strong, nullable) PDFXDestination *destination PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
44 | @property (nonatomic, strong, nullable) PDFXAction *action PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
45 |
46 | /// @name Changing an Outline Hierarchy
47 |
48 | - (void)removeFromParent PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
49 | - (void)insertChild:(PDFXOutline *)child atIndex:(NSUInteger)index PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
50 |
51 | /// @name Managing the Disclosure of an Outline Object
52 |
53 | @property (nonatomic) BOOL isOpen;
54 |
55 | @end
56 |
57 | NS_ASSUME_NONNULL_END
58 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | NSCameraUsageDescription
45 | Pictures captured with the camera can be added to the document as image annotations.
46 | NSMicrophoneUsageDescription
47 | Recording sound annotations requires the microphone.
48 | NSPhotoLibraryAddUsageDescription
49 | Images from documents and annotations can be saved to the photo library.
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAppearanceCharacteristics.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXAnnotation.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | typedef NSString* const PDFXAppearanceCharacteristicsKey NS_STRING_ENUM;
20 |
21 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBackgroundColor;
22 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBorderColor;
23 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyCaption;
24 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyDownCaption;
25 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRolloverCaption;
26 | PDFX_EXTERN PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRotation;
27 |
28 | @interface PDFXAppearanceCharacteristics : NSObject
29 |
30 | @property (nonatomic) PDFXWidgetControlType controlType PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
31 | @property (nonatomic, copy, nullable) PDFXColor *backgroundColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
32 |
33 | @property (nonatomic, copy, nullable) PDFXColor *borderColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
34 | @property (nonatomic) NSInteger rotation PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
35 |
36 | @property (nonatomic, copy, nullable) NSString *caption PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
37 | @property (nonatomic, copy, nullable) NSString *rolloverCaption PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
38 |
39 | @property (nonatomic, copy, nullable) NSString *downCaption PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
40 | @property (nonatomic, readonly, copy) NSDictionary *appearanceCharacteristicsKeyValues PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This wrapper is licensed with a modified BSD license.
2 |
3 | In plain language: you're allowed to do whatever you wish with
4 | the code, modify, redistribute, embed in your products (free or
5 | commercial), but you must include copyright, terms of usage and
6 | disclaimer as stated in the license.
7 |
8 | You will require a commercial PSPDFKit License to run these examples
9 | in non-demo mode. Please refer to sales@pspdfkit.com for details.
10 |
11 | Copyright (c) 2010-2017, PSPDFKit GmbH.
12 | All rights reserved.
13 |
14 | Redistribution and use in source or binary forms,
15 | with or without modification, are permitted provided
16 | that the following conditions are met:
17 |
18 | - Redistributions of source code must retain the above copyright
19 | notice, this list of conditions and the following disclaimer.
20 |
21 | - Redistributions in binary form must reproduce the above copyright
22 | notice, this list of conditions and the following disclaimer in the
23 | documentation and/or other materials provided with the
24 | distribution.
25 |
26 | - Redistributions of PSPDFKit Samples must include attribution to
27 | PSPDFKit, either in documentation or other appropriate media.
28 |
29 | - Neither the name of the PSPDFKit, PSPDFKit GmbH, nor its developers
30 | may be used to endorse or promote products derived from
31 | this software without specific prior written permission.
32 |
33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
40 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
41 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXSelection.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXPage.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class PDFXDocument;
20 |
21 | @interface PDFXSelection : NSObject
22 |
23 | /// @name Initializing a Selection
24 |
25 | - (instancetype)initWithDocument:(PDFXDocument *)document PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
26 |
27 | /// @name Getting Information About a Selection
28 |
29 | @property (nonatomic, readonly) NSArray *pages PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
30 |
31 | @property (nonatomic, readonly, nullable) NSString *string PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
32 | @property (nonatomic, readonly, nullable) NSAttributedString *attributedString PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
33 |
34 | - (PDFXRect)boundsForPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
35 | - (NSArray *)selectionsByLine PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
36 |
37 | @property (nonatomic, copy, nullable) PDFXColor *color PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
38 |
39 | - (NSUInteger)numberOfTextRangesOnPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
40 | - (NSRange)rangeAtIndex:(NSUInteger)index onPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
41 |
42 | /// @name Modifying a Selection
43 |
44 | - (void)addSelection:(PDFXSelection *)selection PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
45 | - (void)addSelections:(NSArray *)selections PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
46 |
47 | - (void)extendSelectionAtEnd:(NSInteger)succeed PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
48 | - (void)extendSelectionAtStart:(NSInteger)precede PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
49 |
50 | - (void)extendSelectionForLineBoundaries PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
51 |
52 | /// @name Managing Selection Drawing
53 |
54 | - (void)drawForPage:(PDFXPage *)page active:(BOOL)active PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
55 | - (void)drawForPage:(PDFXPage *)page withBox:(PDFXDisplayBox)box active:(BOOL)active PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
56 |
57 | @end
58 |
59 | NS_ASSUME_NONNULL_END
60 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #ifndef PDFX_APPLE_PDFKIT_SOURCE_COMPATIBLE
10 | #define PDFX_APPLE_PDFKIT_SOURCE_COMPATIBLE 1
11 | #endif
12 |
13 | #if FRAMEWORK_BUILD
14 |
15 | #import
16 | #import
17 | #import
18 | #import
19 | #import
20 | #import
21 | #import
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import
27 | #import
28 | #import
29 | #import
30 | #import
31 | #import
32 |
33 | #import
34 | #import
35 |
36 | // WORKAROUND: bridging headers aren't supported for framework targets (yet?),
37 | // we therefore need to make the Swift stuff public and expose to ObjC for the
38 | // time being.
39 | #import
40 |
41 | #if PDFX_APPLE_PDFKIT_SOURCE_COMPATIBLE
42 | #import
43 | #endif
44 |
45 | #else
46 |
47 | #import "PDFXAction.h"
48 | #import "PDFXActionGoTo.h"
49 | #import "PDFXActionNamed.h"
50 | #import "PDFXActionResetForm.h"
51 | #import "PDFXActionRemoteGoTo.h"
52 | #import "PDFXActionURL.h"
53 | #import "PDFXAnnotation.h"
54 | #import "PDFXAnnotationPopup.h"
55 | #import "PDFXAppearanceCharacteristics.h"
56 | #import "PDFXBorder.h"
57 | #import "PDFXDestination.h"
58 | #import "PDFXDocument.h"
59 | #import "PDFXOutline.h"
60 | #import "PDFXPage.h"
61 | #import "PDFXSelection.h"
62 | #import "PDFXThumbnailView.h"
63 | #import "PDFXView.h"
64 |
65 | #import "PDFXDocumentDelegate.h"
66 | #import "PDFXViewDelegate.h"
67 |
68 | // WORKAROUND: bridging headers aren't supported for framework targets (yet?),
69 | // we therefore need to make the Swift stuff public and expose to ObjC for the
70 | // time being.
71 | #import "PDFXKit+Swift.h"
72 |
73 | #if PDFX_APPLE_PDFKIT_SOURCE_COMPATIBLE
74 | #import "PDFXCompatibility.h"
75 | #endif
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/PDFXKit.xcodeproj/xcshareddata/xcschemes/PDFXKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
54 |
60 |
61 |
67 |
68 |
69 |
70 |
72 |
73 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXCompatibility.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #pragma mark - Classes
10 |
11 | #define PDFAction PDFXAction
12 | #define PDFActionGoTo PDFXActionGoTo
13 | #define PDFActionNamed PDFXActionNamed
14 | #define PDFActionResetForm PDFXActionResetForm
15 | #define PDFActionRemoteGoTo PDFXActionRemoteGoTo
16 | #define PDFActionURL PDFXActionURL
17 | #define PDFAnnotation PDFXAnnotation
18 | #define PDFAnnotationPopup PDFXAnnotationPopup
19 | #define PDFAppearanceCharacteristics PDFXAppearanceCharacteristics
20 | #define PDFBorder PDFXBorder
21 | #define PDFDestination PDFXDestination
22 | #define PDFDocument PDFXDocument
23 | #define PDFOutline PDFXOutline
24 | #define PDFPage PDFXPage
25 | #define PDFSelection PDFXSelection
26 | #define PDFThumbnailView PDFXThumbnailView
27 | #define PDFView PDFXView
28 |
29 | #pragma mark - Protocols
30 |
31 | #define PDFViewDelegate PDFXViewDelegate
32 |
33 | #pragma mark - Notifications
34 |
35 | #define PDFDocumentDidUnlockNotification PDFXDocumentDidUnlockNotification
36 | #define PDFDocumentDidBeginFindNotification PDFXDocumentDidBeginFindNotification
37 | #define PDFDocumentDidEndFindNotification PDFXDocumentDidEndFindNotification
38 | #define PDFDocumentDidBeginPageFindNotification PDFXDocumentDidBeginPageFindNotification
39 | #define PDFDocumentDidEndPageFindNotification PDFXDocumentDidEndPageFindNotification
40 | #define PDFDocumentDidFindMatchNotification PDFXDocumentDidFindMatchNotification
41 | #define PDFDocumentDidBeginWriteNotification PDFXDocumentDidBeginWriteNotification
42 | #define PDFDocumentDidEndWriteNotification PDFXDocumentDidEndWriteNotification
43 | #define PDFDocumentDidBeginPageWriteNotification PDFXDocumentDidBeginPageWriteNotification
44 | #define PDFDocumentDidEndPageWriteNotification PDFXDocumentDidEndPageWriteNotification
45 |
46 | #define PDFThumbnailViewDocumentEditedNotification PDFXThumbnailViewDocumentEditedNotification
47 |
48 | #define PDFViewDocumentChangedNotification PDFXViewDocumentChangedNotification
49 | #define PDFViewChangedHistoryNotification PDFXViewChangedHistoryNotification
50 | #define PDFViewPageChangedNotification PDFXViewPageChangedNotification
51 | #define PDFViewScaleChangedNotification PDFXViewScaleChangedNotification
52 | #define PDFViewAnnotationHitNotification PDFXViewAnnotationHitNotification
53 | #define PDFViewCopyPermissionNotification PDFXViewCopyPermissionNotification
54 | #define PDFViewPrintPermissionNotification PDFXViewPrintPermissionNotification
55 | #define PDFViewAnnotationWillHitNotification PDFXViewAnnotationWillHitNotification
56 | #define PDFViewSelectionChangedNotification PDFXViewSelectionChangedNotification
57 | #define PDFViewDisplayModeChangedNotification PDFXViewDisplayModeChangedNotification
58 | #define PDFViewDisplayBoxChangedNotification PDFXViewDisplayBoxChangedNotification
59 | #define PDFViewVisiblePagesChangedNotification PDFXViewVisiblePagesChangedNotification
60 |
61 | #pragma mark - Other
62 |
63 | #define kPDFDestinationUnspecifiedValue kPDFXDestinationUnspecifiedValue
64 |
--------------------------------------------------------------------------------
/Example/PDFXKitExample.xcodeproj/xcshareddata/xcschemes/PDFXKitExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
45 |
51 |
52 |
53 |
54 |
60 |
62 |
68 |
69 |
70 |
71 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXDestination.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXDestination+PSPDFKit.h"
10 | #import "PDFXPage+PSPDFKit.h"
11 |
12 | #import "PDFXPlatform+Private.h"
13 | #import "PSPDFKit+PDFXKit.h"
14 |
15 | #import
16 |
17 | CGFloat const kPDFXDestinationUnspecifiedValue = 3.4028234663852886e+38;
18 |
19 | @implementation PDFXDestination
20 |
21 | #pragma mark - Initializing the Class
22 |
23 | + (void)initialize {
24 | if (@available(iOS 11, *)) {
25 | if (kPDFXDestinationUnspecifiedValue != kPDFDestinationUnspecifiedValue) {
26 | [NSException raise:NSInternalInconsistencyException format:@"The constant kPDFXDestinationUnspecifiedValue = '%@' should equal kPDFDestinationUnspecifiedValue = '%@' but doesn't.", @(kPDFXDestinationUnspecifiedValue), @(kPDFDestinationUnspecifiedValue)];
27 | }
28 | }
29 | }
30 |
31 | #pragma mark - Initializing a Destination
32 |
33 | - (instancetype)initWithPage:(PDFXPage *)page atPoint:(PDFXPoint)point {
34 | if ((self = [super init])) {
35 | _page = page;
36 | _point = point;
37 | _zoom = kPDFXDestinationUnspecifiedValue;
38 | }
39 | return self;
40 | }
41 |
42 | #pragma mark - Comparing Destinations
43 |
44 | - (NSComparisonResult)compare:(PDFXDestination *)destination {
45 | let leftDocument = self.page.document;
46 | let rightDocument = destination.page.document;
47 |
48 | if (leftDocument == nil) {
49 | [NSException raise:NSInternalInconsistencyException format:@"Can't compare destinations, page of left destination doesn't have an associated document: %@", self];
50 | return NSOrderedSame;
51 | }
52 |
53 | if (rightDocument == nil) {
54 | [NSException raise:NSInternalInconsistencyException format:@"Can't compare destinations, page of right destination doesn't have an associated document: %@", destination];
55 | return NSOrderedSame;
56 | }
57 |
58 | if (leftDocument != rightDocument) {
59 | [NSException raise:NSInternalInconsistencyException format:@"Can't compare destinations, pages of both destinations have different associated documents. Left destination: %@, right destination: %@", self, destination];
60 | return NSOrderedSame;
61 | }
62 |
63 | let leftPoint = self.point;
64 | let rightPoint = destination.point;
65 |
66 | // Simplify comparison by using CGFLOAT_MAX to avoid handling special cases.
67 | let leftPointY = leftPoint.y == kPDFXDestinationUnspecifiedValue ? CGFLOAT_MAX : leftPoint.y;
68 | let rightPointY = rightPoint.y == kPDFXDestinationUnspecifiedValue ? CGFLOAT_MAX : rightPoint.y;
69 |
70 | if (leftPointY < rightPointY) {
71 | return NSOrderedDescending;
72 | }
73 |
74 | if (leftPointY > rightPointY) {
75 | return NSOrderedAscending;
76 | }
77 |
78 | return NSOrderedSame;
79 | }
80 |
81 | #pragma mark - NSCopying
82 |
83 | - (id)copyWithZone:(NSZone *)zone {
84 | PDFXDestination *copy = [[self.class alloc] initWithPage:self.page atPoint:self.point];
85 | copy.zoom = self.zoom;
86 | return copy;
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXThumbnailView.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXThumbnailView+PSPDFKit.h"
10 | #import "PDFXView+PSPDFKit.h"
11 | #import "PDFXPlatform+Private.h"
12 | #import "PSPDFKit+PDFXKit.h"
13 |
14 | @implementation PDFXThumbnailView
15 |
16 | NSNotificationName const PDFXThumbnailViewDocumentEditedNotification = @"PDFXThumbnailViewDocumentEditedNotification";
17 |
18 | #pragma mark - Initializing a Thumbnail View
19 |
20 | - (instancetype)initWithFrame:(CGRect)frame {
21 | if ((self = [super initWithFrame:frame])) {
22 | [self PDFXThumbnailViewLoad];
23 | }
24 | return self;
25 | }
26 |
27 | // @private common init method used for regular initialization and NSCoding.
28 | - (void)PDFXThumbnailViewLoad {
29 | self.translatesAutoresizingMaskIntoConstraints = NO;
30 |
31 | _pspdfScrubberBar = [PSPDFScrubberBar new];
32 | _pspdfScrubberBar.translatesAutoresizingMaskIntoConstraints = NO;
33 | _pspdfScrubberBar.delegate = self;
34 | [self addSubview:_pspdfScrubberBar];
35 |
36 | [_pspdfScrubberBar.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
37 | [_pspdfScrubberBar.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES;
38 | [_pspdfScrubberBar.leadingAnchor constraintEqualToAnchor:self.leadingAnchor].active = YES;
39 | [_pspdfScrubberBar.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES;
40 | }
41 |
42 | #pragma mark - Miscellaneous
43 |
44 | - (void)setPDFView:(PDFXView *)PDFView {
45 | if (_PDFView != PDFView) {
46 | _PDFView = PDFView;
47 | self.pspdfScrubberBar.dataSource = PDFView.pspdfViewController;
48 | }
49 | }
50 |
51 | // @property (nonatomic) PDFXSize thumbnailSize PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
52 | // @property (nonatomic, copy, nullable) PDFXColor *backgroundColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
53 |
54 | // @property (nonatomic) PDFXThumbnailLayoutMode layoutMode PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
55 | // @property (nonatomic) PDFXEdgeInsets contentInset PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
56 |
57 | // @property (nonatomic, readonly, strong, nullable) NSArray *selectedPages PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
58 |
59 | #pragma mark - NSCoding
60 |
61 | - (instancetype)initWithCoder:(NSCoder *)coder {
62 | if ((self = [super initWithCoder:coder])) {
63 | [self PDFXThumbnailViewLoad];
64 | }
65 | return self;
66 | }
67 |
68 | - (void)encodeWithCoder:(NSCoder *)coder {
69 | [super encodeWithCoder:coder];
70 | }
71 |
72 | #pragma mark - PSPDFScrubberBarDelegate
73 |
74 | - (void)scrubberBar:(PSPDFScrubberBar *)scrubberBar didSelectPageAtIndex:(NSUInteger)pageIndex {
75 | let document = self.PDFView.document;
76 | if (document == nil) { return; }
77 |
78 | let page = [self.PDFView.document pageAtIndex:pageIndex];
79 | if (page == nil) { return; }
80 |
81 | [self.PDFView goToPage:page];
82 |
83 | // HACK: the scrubber bar doesn't update itself which might be a bug as
84 | // described in issue #11842. Until this is resolved, we'll mark this as
85 | // workaround and update the page index manually.
86 | //
87 | // For more info, see issue #11842:
88 | // https://github.com/PSPDFKit/PSPDFKit/issues/11842
89 | [self.pspdfScrubberBar setPageIndex:pageIndex];
90 | }
91 |
92 | @end
93 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXOutline.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXOutline+PSPDFKit.h"
10 | #import "PDFXDocument+PSPDFKit.h"
11 | #import "PDFXDestination+PSPDFKit.h"
12 |
13 | #import "PDFXPlatform+Private.h"
14 | #import "PSPDFKit+PDFXKit.h"
15 |
16 | @interface PDFXOutline ()
17 |
18 | @property (nonatomic, strong, readwrite) NSArray *children;
19 |
20 | @end
21 |
22 | @implementation PDFXOutline
23 |
24 | - (instancetype)init {
25 | if ((self = [super init])) {
26 | // TODO: implement.
27 | }
28 | return self;
29 | }
30 |
31 | #pragma mark - Getting Information About an Outline
32 |
33 | - (NSUInteger)numberOfChildren {
34 | return self.children.count;
35 | }
36 |
37 | - (PDFXOutline *)childAtIndex:(NSUInteger)index {
38 | return [self.children objectAtIndex:index];
39 | }
40 |
41 | #pragma mark - Managing Outline Labels
42 |
43 | - (NSString *)label {
44 | return self.pspdfOutlineElement.title;
45 | }
46 |
47 | - (void)setLabel:(NSString *)label {
48 | // TODO: implement.
49 | }
50 |
51 | #pragma mark - Managing Actions and Destinations
52 |
53 | - (PDFXDestination *)destination {
54 | // TODO: can we get the exact point and zoom for the destination here?
55 | let pageIndex = self.pspdfOutlineElement.pageIndex;
56 | let page = [self.document pageAtIndex:pageIndex];
57 | return [[PDFXDestination alloc] initWithPage:page atPoint:CGPointMake(kPDFXDestinationUnspecifiedValue, kPDFXDestinationUnspecifiedValue)];
58 | }
59 |
60 | // @property (nonatomic, strong, nullable) PDFXAction *action;
61 |
62 | #pragma mark - Changing an Outline Hierarchy
63 |
64 | - (void)removeFromParent {
65 | // TODO: implement.
66 | }
67 |
68 | - (void)insertChild:(PDFXOutline *)child atIndex:(NSUInteger)index {
69 | // TODO: implement.
70 | }
71 |
72 | #pragma mark - Managing the Disclosure of an Outline Object
73 |
74 | - (BOOL)isOpen {
75 | return self.pspdfOutlineElement.expanded;
76 | }
77 |
78 | - (void)setIsOpen:(BOOL)isOpen {
79 | self.pspdfOutlineElement.expanded = isOpen;
80 | }
81 |
82 | #pragma mark - PSPDFKit
83 |
84 | - (instancetype)initWithPSPDFOutlineElement:(PSPDFOutlineElement *)pspdfOutlineElement index:(NSUInteger)index parent:(nullable PDFXOutline *)parent document:(PDFXDocument *)document {
85 | if ((self = [super init])) {
86 | _index = index;
87 | _parent = parent;
88 | _document = document;
89 | _pspdfOutlineElement = pspdfOutlineElement;
90 |
91 | // OPTIMIZE: this is a quick & dirty brute force implementation
92 | // allocating a `PDFXOutline` instance for each outline object in the
93 | // outline hierarchy at creation time. This can be made more efficient
94 | // by only allocating & caching the outline objects currently needed or
95 | // in use.
96 | let children = [NSMutableArray new];
97 | [pspdfOutlineElement.children enumerateObjectsUsingBlock:^(PSPDFOutlineElement *pspdfChild, NSUInteger index, BOOL *stop) {
98 | let child = [[PDFXOutline alloc] initWithPSPDFOutlineElement:pspdfChild index:index parent:self document:document];
99 | [children addObject:child];
100 | }];
101 |
102 | self.children = children;
103 | }
104 | return self;
105 | }
106 |
107 | @end
108 |
--------------------------------------------------------------------------------
/Sources/PDFXKit/PDFXCompatibility.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | import Foundation
10 |
11 | #if SWIFT_PACKAGE
12 | import PDFXKitObjC
13 | #endif
14 |
15 | // MARK: - Classes
16 |
17 | public typealias PDFAction = PDFXAction
18 | public typealias PDFActionGoTo = PDFXActionGoTo
19 | public typealias PDFActionNamed = PDFXActionNamed
20 | public typealias PDFActionResetForm = PDFXActionResetForm
21 | public typealias PDFActionRemoteGoTo = PDFXActionRemoteGoTo
22 | public typealias PDFActionURL = PDFXActionURL
23 | public typealias PDFAnnotation = PDFXAnnotation
24 | public typealias PDFAnnotationPopup = PDFXAnnotationPopup
25 | public typealias PDFAppearanceCharacteristics = PDFXAppearanceCharacteristics
26 | public typealias PDFBorder = PDFXBorder
27 | public typealias PDFDestination = PDFXDestination
28 | public typealias PDFDocument = PDFXDocument
29 | public typealias PDFOutline = PDFXOutline
30 | public typealias PDFPage = PDFXPage
31 | public typealias PDFSelection = PDFXSelection
32 | public typealias PDFThumbnailView = PDFXThumbnailView
33 | public typealias PDFView = PDFXView
34 |
35 | // MARK: - Protocols
36 |
37 | public typealias PDFDocumentDelegate = PDFXDocumentDelegate
38 | public typealias PDFViewDelegate = PDFXViewDelegate
39 |
40 | // MARK: - Notifications
41 |
42 | // Aliasing notification names produces name conflicts with PDFKit if both are
43 | // imported within a project, even if you don't import both within a single
44 | // Swift file. Might be a Swift bug?
45 |
46 | //public extension Notification.Name {
47 | // static let PDFDocumentDidUnlock = Notification.Name.PDFXDocumentDidUnlock
48 | // static let PDFDocumentDidBeginFind = Notification.Name.PDFXDocumentDidBeginFind
49 | // static let PDFDocumentDidEndFind = Notification.Name.PDFXDocumentDidEndFind
50 | // static let PDFDocumentDidBeginPageFind = Notification.Name.PDFXDocumentDidBeginPageFind
51 | // static let PDFDocumentDidEndPageFind = Notification.Name.PDFXDocumentDidEndPageFind
52 | // static let PDFDocumentDidFindMatch = Notification.Name.PDFXDocumentDidFindMatch
53 | // static let PDFDocumentDidBeginWrite = Notification.Name.PDFXDocumentDidBeginWrite
54 | // static let PDFDocumentDidEndWrite = Notification.Name.PDFXDocumentDidEndWrite
55 | // static let PDFDocumentDidBeginPageWrite = Notification.Name.PDFXDocumentDidBeginPageWrite
56 | // static let PDFDocumentDidEndPageWrite = Notification.Name.PDFXDocumentDidEndPageWrite
57 | //}
58 | //
59 | //public extension Notification.Name {
60 | // static let PDFThumbnailViewDocumentEdited = Notification.Name.PDFXThumbnailViewDocumentEdited
61 | //}
62 | //
63 | //public extension Notification.Name {
64 | // static let PDFViewDocumentChanged = Notification.Name.PDFXViewDocumentChanged
65 | // static let PDFViewChangedHistory = Notification.Name.PDFXViewChangedHistory
66 | // static let PDFViewPageChanged = Notification.Name.PDFXViewPageChanged
67 | // static let PDFViewScaleChanged = Notification.Name.PDFXViewScaleChanged
68 | // static let PDFViewAnnotationHit = Notification.Name.PDFXViewAnnotationHit
69 | // static let PDFViewCopyPermission = Notification.Name.PDFXViewCopyPermission
70 | // static let PDFViewPrintPermission = Notification.Name.PDFXViewPrintPermission
71 | // static let PDFViewAnnotationWillHit = Notification.Name.PDFXViewAnnotationWillHit
72 | // static let PDFViewSelectionChanged = Notification.Name.PDFXViewSelectionChanged
73 | // static let PDFViewDisplayModeChanged = Notification.Name.PDFXViewDisplayModeChanged
74 | // static let PDFViewDisplayBoxChanged = Notification.Name.PDFXViewDisplayBoxChanged
75 | // static let PDFViewVisiblePagesChanged = Notification.Name.PDFXViewVisiblePagesChanged
76 | //}
77 |
78 | // MARK: - Other
79 |
80 | let kPDFDestinationUnspecifiedValue = kPDFXDestinationUnspecifiedValue;
81 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #else
12 | #import "PDFXPlatform.h"
13 | #endif
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | typedef NS_ENUM(NSInteger, PDFXDisplayBox) {
18 | kPDFXDisplayBoxMediaBox = 0,
19 | kPDFXDisplayBoxCropBox = 1,
20 | kPDFXDisplayBoxBleedBox = 2,
21 | kPDFXDisplayBoxTrimBox = 3,
22 | kPDFXDisplayBoxArtBox = 4
23 | };
24 |
25 | @class PDFXAnnotation;
26 | @class PDFXDocument;
27 | @class PDFXPage;
28 | @class PDFXSelection;
29 |
30 | @interface PDFXPage : NSObject
31 |
32 | /// @name Initializing a Page
33 |
34 | /**
35 | Equivalent to creating a page by initializing without a document and inserting
36 | that page at the end of the document.
37 | */
38 | - (nullable instancetype)initWithDocument:(PDFXDocument *)document PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
39 | - (nullable instancetype)initWithImage:(PDFXImage *)image PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
40 |
41 | /// @name Getting Information About a Page
42 |
43 | @property (nonatomic, readonly, weak, nullable) PDFXDocument *document PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
44 | @property (nonatomic, readonly, nullable) NSString *label PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
45 |
46 | - (PDFXRect)boundsForBox:(PDFXDisplayBox)box PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
47 | - (void)setBounds:(PDFXRect)bounds forBox:(PDFXDisplayBox)box PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
48 |
49 | @property (nonatomic) NSInteger rotation PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
50 |
51 | /// @name Working with Annotations
52 |
53 | @property (nonatomic, readonly) NSArray *annotations PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
54 | @property (nonatomic) BOOL displaysAnnotations PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
55 |
56 | - (void)addAnnotation:(PDFXAnnotation *)annotation PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
57 | - (void)removeAnnotation:(PDFXAnnotation *)annotation PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
58 | - (nullable PDFXAnnotation *)annotationAtPoint:(PDFXPoint)point PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
59 |
60 | /// @name Rendering Pages
61 |
62 | - (PDFXAffineTransform)transformForBox:(PDFXDisplayBox)box PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
63 |
64 | - (void)drawWithBox:(PDFXDisplayBox)box toContext:(CGContextRef)context PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
65 | - (void)transformContext:(CGContextRef)context forBox:(PDFXDisplayBox)box PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
66 |
67 | - (PDFXImage *)thumbnailOfSize:(PDFXSize)size forBox:(PDFXDisplayBox)box PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
68 |
69 | /// @name Working with Textual Content
70 |
71 | @property (nonatomic, readonly) NSUInteger numberOfCharacters PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
72 |
73 | @property (nonatomic, readonly, nullable) NSString *string PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
74 | @property (nonatomic, readonly, nullable) NSAttributedString *attributedString PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
75 |
76 | - (PDFXRect)characterBoundsAtIndex:(NSInteger)index PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
77 | - (NSInteger)characterIndexAtPoint:(PDFXPoint)point PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
78 |
79 | /// @name Working with Selections
80 |
81 | - (nullable PDFXSelection *)selectionForRect:(PDFXRect)rect PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
82 |
83 | - (nullable PDFXSelection *)selectionForWordAtPoint:(PDFXPoint)point PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
84 | - (nullable PDFXSelection *)selectionForLineAtPoint:(PDFXPoint)point PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
85 |
86 | - (nullable PDFXSelection *)selectionFromPoint:(PDFXPoint)startPoint toPoint:(PDFXPoint)endPoint PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
87 | - (nullable PDFXSelection *)selectionForRange:(NSRange)range PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
88 |
89 | /// @name Miscellanneous
90 |
91 | @property (nonatomic, readonly) NSData *dataRepresentation PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
92 | @property (nonatomic, readonly, nullable) CGPDFPageRef pageRef PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
93 |
94 | @end
95 |
96 | NS_ASSUME_NONNULL_END
97 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXSelection.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXSelection+Private.h"
10 | #import "PDFXSelection+PSPDFKit.h"
11 | #import "PDFXDocument+PSPDFKit.h"
12 | #import "PDFXPlatform+Private.h"
13 | #import "PSPDFKit+PDFXKit.h"
14 |
15 | @interface PDFXSelection ()
16 |
17 | @property (nonatomic, readwrite, nullable) NSString *string;
18 | @property (nonatomic) PDFXDocument *document;
19 | @property (nonatomic) PDFXPage *page;
20 | @property (nonatomic) NSRange range;
21 |
22 | @end
23 |
24 | @implementation PDFXSelection
25 |
26 | #pragma mark - Initializing a Selection
27 |
28 | - (instancetype)initWithDocument:(PDFXDocument *)document {
29 | return [self initWithDocument:document page:nil range:NSMakeRange(NSNotFound, 0) string:nil];
30 | }
31 |
32 | #pragma mark - Getting Information About a Selection
33 |
34 | - (NSArray *)pages {
35 | return @[self.page];
36 | }
37 |
38 | - (NSAttributedString *)attributedString {
39 | return [[NSAttributedString alloc] initWithString:self.string];
40 | }
41 |
42 | - (PDFXRect)boundsForPage:(PDFXPage *)page {
43 | // TODO: implement.
44 | return PDFXRectZero;
45 | }
46 |
47 | - (NSArray*)selectionsByLine {
48 | // TODO: implement.
49 | return @[];
50 | }
51 |
52 | // @property (nonatomic, copy, nullable) PDFXColor *color;
53 |
54 | - (NSUInteger)numberOfTextRangesOnPage:(PDFXPage *)page {
55 | if (self.page == nil) { return 0; }
56 | if (page != self.page) { return 0; }
57 | if (self.range.location == NSNotFound) { return 0; }
58 | return 1;
59 | }
60 |
61 | - (NSRange)rangeAtIndex:(NSUInteger)index onPage:(PDFXPage *)page {
62 | NSParameterAssert(index == 0);
63 | return self.range;
64 | }
65 |
66 | #pragma mark - Modifying a Selection
67 |
68 | - (void)addSelection:(PDFXSelection *)selection {
69 | // TODO: implement.
70 | }
71 |
72 | - (void)addSelections:(NSArray *)selections {
73 | // TODO: implement.
74 | }
75 |
76 | - (void)extendSelectionAtEnd:(NSInteger)succeed {
77 | // TODO: implement.
78 | }
79 |
80 | - (void)extendSelectionAtStart:(NSInteger)precede {
81 | // TODO: implement.
82 | }
83 |
84 | - (void)extendSelectionForLineBoundaries {
85 | // TODO: implement.
86 | }
87 |
88 | #pragma mark - Managing Selection Drawing
89 |
90 | - (void)drawForPage:(PDFXPage *)page active:(BOOL)active {
91 | // TODO: implement.
92 | }
93 |
94 | - (void)drawForPage:(PDFXPage *)page withBox:(PDFXDisplayBox)box active:(BOOL)active {
95 | // TODO: implement.
96 | }
97 |
98 | #pragma mark - NSCopying
99 |
100 | - (id)copyWithZone:(NSZone *)zone {
101 | return [[self.class alloc] initWithDocument:self.document page:self.page range:self.range string:self.string];
102 | }
103 |
104 | #pragma mark - PSPDFKit
105 |
106 | - (nullable instancetype)initWithDocument:(PDFXDocument *)document PSPDFSearchResult:(PSPDFSearchResult *)pspdfSearchResult {
107 | let index = pspdfSearchResult.pageIndex;
108 | let page = [document pageAtIndex:index];
109 | let range = pspdfSearchResult.range;
110 |
111 | // let textParser = [self.pspdfDocument textParserForPageAtIndex:pageIndex];
112 | // TODO: we'll set the preview text for quick test, it should actually
113 | // be the text at that range (which corresponds more or less to the
114 | // search string. Quick & dirty test, please fix.
115 | let string = pspdfSearchResult.previewText;
116 |
117 | if ((self = [self initWithDocument:document page:page range:range string:string])) {
118 | self.pspdfSearchResult = pspdfSearchResult;
119 | }
120 |
121 | return self;
122 | }
123 |
124 | #pragma mark - Private
125 |
126 | - (instancetype)initWithDocument:(PDFXDocument *)document page:(nullable PDFXPage *)page range:(NSRange)range string:(nullable NSString *)string {
127 | if ((self = [super init])) {
128 | _document = document;
129 | _page = page;
130 | _range = range;
131 | _string = string;
132 | }
133 | return self;
134 | }
135 |
136 | @end
137 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXPage+Private.h"
10 | #import "PDFXPage+PSPDFKit.h"
11 | #import "PDFXDocument+PSPDFKit.h"
12 |
13 | #import "PDFXPlatform+Private.h"
14 | #import "PSPDFKit+PDFXKit.h"
15 |
16 | @interface PDFXPage ()
17 |
18 | @property (nonatomic) PDFXImage *image;
19 |
20 | @end
21 |
22 | @implementation PDFXPage
23 |
24 | #pragma mark - Initializing a Page
25 |
26 | - (nullable instancetype)initWithDocument:(PDFXDocument *)document {
27 | if ((self = [self init])) {
28 | if (document != nil) {
29 | // This is a new page that we need to add to the document.
30 | let index = document.pageCount;
31 | [document insertPage:self atIndex:index];
32 | }
33 | }
34 | return self;
35 | }
36 |
37 | - (nullable instancetype)initWithImage:(PDFXImage *)image {
38 | if ((self = [super init])) {
39 | self.image = image;
40 | }
41 | return self;
42 | }
43 |
44 | #pragma mark - Getting Information About a Page
45 |
46 | - (NSString *)label {
47 | return [self.document.pspdfDocument pageLabelForPageAtIndex:self.index substituteWithPlainLabel:NO];
48 | }
49 |
50 | - (PDFXRect)boundsForBox:(PDFXDisplayBox)box {
51 | // TODO: implement.
52 | return PDFXRectZero;
53 | }
54 |
55 | - (void)setBounds:(PDFXRect)bounds forBox:(PDFXDisplayBox)box {
56 | // TODO: implement.
57 | }
58 |
59 | - (NSInteger)rotation {
60 | // TODO: implement.
61 | return 0;
62 | }
63 |
64 | #pragma mark - Working with Annotations
65 |
66 | - (NSArray *)annotations {
67 | // TODO: implement.
68 | return @[];
69 | }
70 |
71 | - (BOOL)displaysAnnotations {
72 | // TODO: implement.
73 | return YES;
74 | }
75 |
76 | - (void)addAnnotation:(PDFXAnnotation *)annotation {
77 | // TODO: implement.
78 | }
79 |
80 | - (void)removeAnnotation:(PDFXAnnotation *)annotation {
81 | // TODO: implement.
82 | }
83 |
84 | - (nullable PDFXAnnotation *)annotationAtPoint:(PDFXPoint)point {
85 | // TODO: implement.
86 | return nil;
87 | }
88 |
89 | #pragma mark - Rendering Pages
90 |
91 | - (PDFXAffineTransform)transformForBox:(PDFXDisplayBox)box {
92 | // TODO: implement.
93 | return PDFXAffineTransformIdentity;
94 | }
95 |
96 | - (void)drawWithBox:(PDFXDisplayBox)box toContext:(CGContextRef)context {
97 | // TODO: implement.
98 | }
99 |
100 | - (void)transformContext:(CGContextRef)context forBox:(PDFXDisplayBox)box {
101 | // TODO: implement.
102 | }
103 |
104 | - (PDFXImage *)thumbnailOfSize:(PDFXSize)size forBox:(PDFXDisplayBox)box {
105 | NSError *error = nil;
106 | let thumbnail = [self.document.pspdfDocument imageForPageAtIndex:self.index size:size clippedToRect:CGRectZero annotations:nil options:nil error:&error];
107 | if (thumbnail == nil) {
108 | NSLog(@"[WARNING] Couldn't render thumbnail for page: %@, error: %@", self, error);
109 | }
110 | return thumbnail;
111 | }
112 |
113 | #pragma mark - Working with Textual Content
114 |
115 | - (NSUInteger)numberOfCharacters {
116 | // TODO: implement.
117 | return 0;
118 | }
119 |
120 | - (NSString *)string {
121 | // TODO: implement.
122 | return @"";
123 | }
124 |
125 | - (NSAttributedString *)attributedString {
126 | // TODO: implement.
127 | return [NSAttributedString new];
128 | }
129 |
130 | - (PDFXRect)characterBoundsAtIndex:(NSInteger)index {
131 | // TODO: implement.
132 | return PDFXRectZero;
133 | }
134 |
135 | - (NSInteger)characterIndexAtPoint:(PDFXPoint)point {
136 | // TODO: implement.
137 | return NSNotFound;
138 | }
139 |
140 | #pragma mark - Working with Selections
141 |
142 | - (nullable PDFXSelection *)selectionForRect:(PDFXRect)rect {
143 | // TODO: implement.
144 | return nil;
145 | }
146 |
147 | - (nullable PDFXSelection *)selectionForWordAtPoint:(PDFXPoint)point {
148 | // TODO: implement.
149 | return nil;
150 | }
151 |
152 | - (nullable PDFXSelection *)selectionForLineAtPoint:(PDFXPoint)point {
153 | // TODO: implement.
154 | return nil;
155 | }
156 |
157 | - (nullable PDFXSelection *)selectionFromPoint:(PDFXPoint)startPoint toPoint:(PDFXPoint)endPoint {
158 | // TODO: implement.
159 | return nil;
160 | }
161 |
162 | - (nullable PDFXSelection *)selectionForRange:(NSRange)range {
163 | // TODO: implement.
164 | return nil;
165 | }
166 |
167 | #pragma mark - Miscellanneous
168 |
169 | - (NSData *)dataRepresentation {
170 | // TODO: implement.
171 | return nil;
172 | }
173 |
174 | - (CGPDFPageRef)pageRef {
175 | // TODO: implement.
176 | return nil;
177 | }
178 |
179 | #pragma mark - NSCopying
180 |
181 | - (id)copyWithZone:(NSZone *)zone {
182 | // TODO: implement.
183 | return [self.class new];
184 | }
185 |
186 | @end
187 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXDocument.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXDocumentDelegate.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class PDFXOutline;
20 | @class PDFXPage;
21 |
22 | typedef NS_ENUM(NSInteger, PDFXDocumentPermissions) {
23 | kPDFXDocumentPermissionsNone = 0,
24 | kPDFXDocumentPermissionsUser = 1,
25 | kPDFXDocumentPermissionsOwner = 2
26 | };
27 |
28 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidUnlockNotification;
29 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidBeginFindNotification;
30 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidEndFindNotification;
31 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidBeginPageFindNotification;
32 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidEndPageFindNotification;
33 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidFindMatchNotification;
34 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidBeginWriteNotification;
35 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidEndWriteNotification;
36 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidBeginPageWriteNotification;
37 | PDFX_EXTERN NSNotificationName const PDFXDocumentDidEndPageWriteNotification;
38 |
39 | typedef NSString *const PDFXDocumentAttribute NS_STRING_ENUM;
40 | typedef NSString *const PDFXDocumentWriteOption NS_STRING_ENUM;
41 |
42 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentAuthorAttribute;
43 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentCreationDateAttribute;
44 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentCreatorAttribute;
45 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentKeywordsAttribute;
46 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentModificationDateAttribute;
47 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentProducerAttribute;
48 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentSubjectAttribute;
49 | PDFX_EXTERN PDFXDocumentAttribute PDFXDocumentTitleAttribute;
50 |
51 | PDFX_EXTERN PDFXDocumentWriteOption PDFXDocumentOwnerPasswordOption;
52 | PDFX_EXTERN PDFXDocumentWriteOption PDFXDocumentUserPasswordOption;
53 |
54 | @interface PDFXDocument : NSObject
55 |
56 | /// @name Initializing Documents
57 |
58 | - (nullable instancetype)initWithData:(NSData *)data;
59 | - (nullable instancetype)initWithURL:(NSURL *)url;
60 |
61 | /// @name Accessing Document Information
62 |
63 | @property (nonatomic, readonly, nullable) NSURL *documentURL;
64 |
65 | @property (nonatomic, readonly) NSInteger majorVersion;
66 | @property (nonatomic, readonly) NSInteger minorVersion;
67 |
68 | @property (nonatomic, readonly, nullable) NSString *string;
69 | @property (nonatomic, copy, nullable) NSDictionary *documentAttributes;
70 |
71 | @property (nonatomic, readonly, nullable) CGPDFDocumentRef documentRef;
72 |
73 | /// @name Working with the Document Outline
74 |
75 | @property (nonatomic, strong, nullable) PDFXOutline *outlineRoot PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_UNKNOWN("Setting the outline root is not supported yet.");
76 | - (nullable PDFXOutline *)outlineItemForSelection:(PDFXSelection *)selection;
77 |
78 | /// @name Managing Document Security
79 |
80 | @property (nonatomic, readonly) BOOL isEncrypted;
81 | @property (nonatomic, readonly) BOOL isLocked;
82 |
83 | - (BOOL)unlockWithPassword:(NSString *)password;
84 |
85 | @property (nonatomic, readonly) BOOL allowsPrinting;
86 | @property (nonatomic, readonly) BOOL allowsCopying;
87 |
88 | @property (nonatomic, readonly) BOOL allowsDocumentChanges;
89 | @property (nonatomic, readonly) BOOL allowsDocumentAssembly;
90 | @property (nonatomic, readonly) BOOL allowsContentAccessibility;
91 | @property (nonatomic, readonly) BOOL allowsCommenting;
92 | @property (nonatomic, readonly) BOOL allowsFormFieldEntry;
93 |
94 | @property (nonatomic, readonly) PDFXDocumentPermissions permissionStatus;
95 |
96 | /// @name Writing Out PDF Data
97 |
98 | - (nullable NSData *)dataRepresentation;
99 | - (nullable NSData *)dataRepresentationWithOptions:(NSDictionary *)options;
100 |
101 | - (BOOL)writeToFile:(NSString *)path;
102 | - (BOOL)writeToFile:(NSString *)path withOptions:(nullable NSDictionary *)options;
103 | - (BOOL)writeToURL:(NSURL *)url;
104 | - (BOOL)writeToURL:(NSURL *)url withOptions:(nullable NSDictionary *)options;
105 |
106 | /// @name Working with Pages
107 |
108 | @property (nonatomic, readonly) NSUInteger pageCount PDFX_OBJC_ONLY;
109 |
110 | - (nullable PDFXPage *)pageAtIndex:(NSUInteger)index PDFX_OBJC_ONLY;
111 | - (NSUInteger)indexForPage:(PDFXPage *)page PDFX_OBJC_ONLY;
112 |
113 | - (void)insertPage:(PDFXPage *)page atIndex:(NSUInteger)index PDFX_OBJC_ONLY;
114 | - (void)removePageAtIndex:(NSUInteger)index PDFX_OBJC_ONLY;
115 | - (void)exchangePageAtIndex:(NSUInteger)indexOfPageToReplace withPageAtIndex:(NSUInteger)indexOfReplacementPage PDFX_OBJC_ONLY;
116 |
117 | /// @name Managing Find Operations
118 |
119 | - (NSArray *)findString:(NSString *)string withOptions:(NSStringCompareOptions)options;
120 | - (nullable PDFXSelection *)findString:(NSString *)string fromSelection:(nullable PDFXSelection *)selection withOptions:(NSStringCompareOptions)options;
121 |
122 | - (void)beginFindString:(NSString *)string withOptions:(NSStringCompareOptions)options NS_SWIFT_NAME(beginFindString(_:withOptions:));
123 | - (void)beginFindStrings:(NSArray *)strings withOptions:(NSStringCompareOptions)options NS_SWIFT_NAME(beginFindString(_:withOptions:));
124 |
125 | @property (nonatomic, readonly) BOOL isFinding;
126 | - (void)cancelFindString;
127 |
128 | /// @name Working with Selections
129 |
130 | - (nullable PDFXSelection *)selectionFromPage:(PDFXPage *)startPage atCharacterIndex:(NSUInteger)startCharacter toPage:(PDFXPage *)endPage atCharacterIndex:(NSUInteger)endCharacter PDFX_OBJC_ONLY;
131 | - (nullable PDFXSelection *)selectionFromPage:(PDFXPage *)startPage atPoint:(PDFXPoint)startPoint toPage:(PDFXPage *)endPage atPoint:(PDFXPoint)endPoint;
132 | @property (nonatomic, readonly, nullable) PDFXSelection *selectionForEntireDocument;
133 |
134 | /// @name Setting the Delegate
135 |
136 | @property (nonatomic, weak, nullable) id delegate;
137 |
138 | /// @name Determining the Page Class
139 |
140 | @property (nonatomic, readonly) Class pageClass;
141 |
142 | @end
143 |
144 | NS_ASSUME_NONNULL_END
145 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PDFXKit
2 |
3 | PDFXKit is a drop-in replacement for [Apple’s
4 | PDFKit](https://developer.apple.com/documentation/pdfkit) using the industry
5 | leading [PSPDFKit](http://pspdfkit.com/) framework under the hood. The latest
6 | version requires [PSPDFKit 11.3 for
7 | iOS](https://pspdfkit.com/changelog/ios/#11.3.0) and Xcode 13.2.1 or later.
8 |
9 | [](https://pspdfkit.com/blog/2017/introducing-pdfxkit/)
10 |
11 | **Note**: [PSPDFKit](http://pspdfkit.com) is a *commercial* product and requires
12 | a [paid license](https://pspdfkit.com/sales/) for production use.
13 |
14 | ## Introduction
15 |
16 | Apple’s PDFKit provides a great starting point if you need to integrate PDF
17 | support into your macOS or iOS app. It is a system library and as such the
18 | easiest to integrate.
19 |
20 | PSPDFKit on the other hand goes much further offering you a cross-platform
21 | drop-in solution with many additional UI components, advanced PDF features,
22 | and first class support directly from the developers.
23 |
24 | Migrating the full code base to PSPDFKit can be a major undertaking and a deal
25 | breaker for many developers. This is where PDFXKit comes in. It is a drop-in
26 | replacement giving you the same API as PDFKit while using PSPDFKit under the
27 | hood.
28 |
29 | For more details, please consult the
30 | [announcement blog post](https://pspdfkit.com/blog/2017/introducing-pdfxkit/)
31 | as well as the
32 | [Migrating from Apple PDFKit](https://pspdfkit.com/guides/ios/current/migration-guides/migrating-from-apple-pdfkit/)
33 | guide.
34 |
35 | ## Support, Issues and License Questions
36 |
37 | PSPDFKit offers support for customers with an active SDK license via https://pspdfkit.com/support/request/
38 |
39 | Are you [evaluating our SDK](https://pspdfkit.com/try/)? That’s great, we’re happy to help out! To make sure this is fast, please use a work email and have someone from your company fill out our [sales form](https://pspdfkit.com/sales/).
40 |
41 | ## Getting Started
42 |
43 | You can freely evaluate PSPDFKit without a license. The framework will display a watermark on the opened PDFs.
44 | For production use and licensing please refer to the previous section.
45 |
46 | ### Using Swift Package Manager
47 |
48 | Add PDFXKit Swift Package to your project:
49 | - In Xcode 13 or higher, go to File / Add Packages… and enter the following package repository URL into the search field: `https://github.com/PSPDFKit/PDFXKit`.
50 | - Select “Up to Next Major Version” follow the instructions to finish the setup
51 |
52 | ### Using CocoaPods
53 |
54 | We assume you are familiar with [CocoaPods](https://cocoapods.org), otherwise
55 | please consult the documentation first.
56 |
57 | First, you’ll have to add PDFXKit as a dependency to your `Podfile`:
58 |
59 | ``` Ruby
60 | # Replace `YourAppName` with your app’s target name.
61 | target :YourAppName do
62 | pod 'PDFXKit', :git => "git@github.com:PSPDFKit/PDFXKit.git", :branch => "master"
63 | end
64 | ```
65 |
66 | Now run `pod install`. Afterwards you should be able to build & run your project
67 | without errors. Next you’ll have to adapt your project to use PDFXKit as
68 | described in Section [Switch to PDFXKit](#switch-to-pdfxkit).
69 |
70 | ### Manual Setup
71 |
72 | **Note:** manual setup is only for experts, we assume you know what you are
73 | doing. If you are unsure, please use Swift Package Manager instead.
74 |
75 | First, build the PDFXKit framework:
76 |
77 | * Clone `git@github.com:PSPDFKit/PDFXKit.git`
78 | * Open the terminal and `cd` into the `PDFXKit` directory
79 | * Run `rake compile`
80 |
81 | You should now have the `PDFXFKit.xcframework` in the `Build` folder. Next, add
82 | the `PSPDFKit.xcframework`, `PSPDFKitUI.xcframework`, and `PDFXKit.xcframework` to your project:
83 |
84 | * Follow the [*Getting Started*](https://pspdfkit.com/guides/ios/current/getting-started/integrating-pspdfkit/) instructions for PSPDFKit.
85 |
86 | * Perform steps (1) and (2) from the above *Getting Started* guide, Section
87 | [Integrating the Dynamic Framework](https://pspdfkit.com/guides/ios/current/getting-started/integrating-pspdfkit/#toc_integrating-the-dynamic-framework),
88 | and add PDFXKit to your app similar to how you did it with PSPDFKit above. You
89 | may also want to set up your [test targets](https://pspdfkit.com/guides/ios/current/getting-started/integrating-pspdfkit/#toc_test-targets) accordingly.
90 |
91 | You should now be able to build & run your app.
92 |
93 | ### Switch to PDFXKit
94 |
95 | First, register the PSPDFKit license for your project as described in
96 | [*Adding the License
97 | Key*](https://pspdfkit.com/guides/ios/current/getting-started/adding-the-license-key/)
98 | guide.
99 |
100 | Now we need to perform a couple of small changes in order to make your project use
101 | PDFXKit instead of the system PDFKit.
102 |
103 | Update all source files to import `PDFXKit` instead of the `PDFKit`
104 | framework using Xcode’s project-wide search & replace:
105 |
106 | * Open your project in Xcode
107 | * Bring up the search & replace panel (Menu `Find` -> `Find and Replace in Project...`)
108 | * Search & replace `import PDFKit` with `import PDFXKit`
109 | * Search & replace `#import ` with `#import `
110 |
111 | If you are using storyboards or xibs, update all custom classes:
112 |
113 | * Open each storyboard and replace all custom classes set to `PDFView` and
114 | `PDFThumbnailView` to `PDFXView` and `PDFXThumbnailView`.
115 |
116 | * Open each xib and replace all custom classes set to `PDFView` and
117 | `PDFThumbnailView` to `PDFXView` and `PDFXThumbnailView`
118 |
119 | If you are using Swift:
120 |
121 | * Build & run your project, it should produce build errors for every use of a
122 | PDFKit notification constant, fix those by adding an `X` to the prefix, i.e.
123 | `.PDFViewPageChanged` should be renamed to `.PDFXViewPageChanged`.
124 |
125 | Build & run your project, your app is now using PDFXKit with PSPDFKit under the
126 | hood.
127 |
128 | Now make sure your app works as expected. Specifically, there might be a
129 | conflict with your gesture recognizers. If so, implement the
130 | `gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)` delegate method
131 | for the conflicting gesture recognizer and return `true`.
132 |
133 | ## Limitations
134 |
135 | PDFXKit is beta software, many parts aren’t implemented yet. Please take a
136 | look at the headers, all unimplemented or only partially implemented symbols are
137 | annotated with the `PDFX_NOT_IMPLEMENTED_PRIORITY_...` and
138 | `PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_...` macros.
139 |
140 | ## Run the Example Project
141 |
142 | * Clone `git@github.com:PSPDFKit/PDFXKit.git`
143 | * Open `PDFXKit.xcworkspace` and wait for the Swift package manager to download the dependencies
144 | * Build & Run `PDFXKitExample`
145 |
146 | ## Contributing
147 |
148 | Please [sign our CLA agreement](https://pspdfkit.com/guides/web/current/miscellaneous/contributing/) so we can accept your pull requests.
149 |
150 | ## Technical notes
151 |
152 | * All PDFXKit source files live in the `Sources` directory.
153 |
154 | * Each class has a `...+Swift.h` header for Swift-only stuff which isn’t exposed
155 | to Objective-C. Example: `PDFXDocument+Swift.h`.
156 |
157 | * Each class has a `...+PSPDFKit.h` header for public PSPDFKit stuff, i.e. any
158 | interfaces that expose access to PSPDFKit when using PDFXKit. Example:
159 | `PDFXDocument+PSPDFKit.h`.
160 |
161 | * Some of the classes have a `...+Private.h` header for internal stuff, i.e.
162 | needed by PDFXKit classes internally but shouldn’t be exposed publicly.
163 | Example: `PDFXPage+Private.h`, exposes properties only allowed to be
164 | accessible by `PDFXDocument`.
165 |
166 | ## Known Issues
167 |
168 | **Conflicting gesture recognizers**. Your gesture recognizers might be in
169 | conflict with some of PSPDFKit’s recognizers. If so, implement the
170 | `gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)` delegate method
171 | for the conflicting gesture recognizer and return `true`.
172 |
173 | ## License
174 |
175 | The PDFXKit wrapper is released under a modified version of the BSD license, see
176 | [LICENSE.md](LICENSE.md) found at the root of this git repo.
177 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | #
4 | # The PDFXKit is licensed with a modified BSD license. Please see License for
5 | # details. This notice may not be removed from this file.
6 | #
7 | # General Guidelines
8 | # ------------------
9 | #
10 | # Try to avoid file and directory names containing *spaces*.
11 | #
12 | # On the other hand, *quote* every file and directory reference when passing
13 | # it to a command if the reference *might* contain a space.
14 | #
15 | # Avoid encapsulating parts of the build script into functions. As a rule of
16 | # thumb: no function other than `run` should call a shell command (exception:
17 | # generic one-liners to check something for example) and no function should
18 | # call the `run` function itself, `run` is only intended to be used at the task
19 | # level.
20 | #
21 | # Keep intermediate results. If you need to modify a previous result, copy it
22 | # first. This will ease debugging if something goes wrong and allows you to
23 | # comment out certain stages of the script to save time when working on it.
24 | #
25 | # When working within a deep-ish path, consider cd-ing into the directory first.
26 | # You have to do this for each run call, simply prepend your actual command
27 | # with something like `cd some/deep/directory/; ...`. Do *not* change the
28 | # working directory for the whole script though (using Ruby's `File.chdir` &
29 | # friends).
30 |
31 | # Naming Conventions: Constants
32 | # -----------------------------
33 | #
34 | # * A directory name is suffixed with `_DIRECTORY`
35 | # * A file's base name constant is suffixed with `_NAME`
36 | # * A file's full name including extension is suffixed with `_FILE`
37 | # * A full file or directory path (absolute & relative) is suffixed with `_PATH`
38 | # * A directory path should *not* end with a slash `/`
39 | #
40 | # Try to avoid full path constants because it becomes really difficult to read
41 | # and understand the build script, i.e. what file or directory is referenced or
42 | # created and where.
43 |
44 | require 'rubygems'
45 |
46 | # --------------------------------------------------------------- Options ------
47 |
48 | NAME = ENV['name'] || ""
49 | DIRECTORY = File.expand_path(ENV['directory'] || "Build")
50 | VERBOSE = ENV['verbose'] || false
51 |
52 | # ------------------------------------------------------------- Constants ------
53 |
54 | XCODE_FLAGS = "-configuration Release -scheme PDFXKit archive SKIP_INSTALL=NO"
55 | ARCHIVE_PATH_SIMULATOR = "\"#{DIRECTORY}\"/Xcode/Archives/PDFXKit.framework-ios-arm64_x86_64-simulator.xcarchive"
56 | ARCHIVE_PATH_DEVICE = "\"#{DIRECTORY}\"/Xcode/Archives/PDFXKit.framework-ios-arm64.xcarchive"
57 | ARCHIVE_PATH_MAC_CATALYST = "\"#{DIRECTORY}\"/Xcode/Archives/PDFXKit.framework-ios-x86_64-maccatalyst.xcarchive"
58 |
59 | # ---------------------------------------------------------------- Colors ------
60 |
61 | TERMINAL = STDOUT.tty?
62 |
63 | BOLD = TERMINAL ? "\x1B[0;1m" : ""
64 | RESET = TERMINAL ? "\x1B[0m" : ""
65 |
66 | BLACK = TERMINAL ? "\x1B[0;30m" : ""; RED = TERMINAL ? "\x1B[0;31m" : ""; GREEN = TERMINAL ? "\x1B[0;32m" : ""; YELLOW = TERMINAL ? "\x1B[0;33m" : ""; BLUE = TERMINAL ? "\x1B[0;34m" : ""; MAGENTA = TERMINAL ? "\x1B[0;35m" : ""; CYAN = TERMINAL ? "\x1B[0;36m" : ""; WHITE = TERMINAL ? "\x1B[0;37m" : ""
67 | BLACK_BRIGHT = TERMINAL ? "\x1B[1;30m" : ""; RED_BRIGHT = TERMINAL ? "\x1B[1;31m" : ""; GREEN_BRIGHT = TERMINAL ? "\x1B[1;32m" : ""; YELLOW_BRIGHT = TERMINAL ? "\x1B[1;33m" : ""; BLUE_BRIGHT = TERMINAL ? "\x1B[1;34m" : ""; MAGENTA_BRIGHT = TERMINAL ? "\x1B[1;35m" : ""; CYAN_BRIGHT = TERMINAL ? "\x1B[1;36m" : ""; WHITE_BRIGHT = TERMINAL ? "\x1B[1;37m" : ""
68 |
69 | OK = GREEN + "OK" + RESET
70 | FAILED = RED + "FAILED" + RESET
71 | SKIPPED = YELLOW + "SKIPPED" + RESET
72 |
73 | ERROR = RED + "Error:" + RESET
74 | WARNING = YELLOW + "Warning:" + RESET
75 |
76 | # ----------------------------------------------------------------- Tasks ------
77 |
78 | desc "Archive PDFXKit (simulator)"
79 | task 'compile:simulator' => [:prepare] do
80 | tell "Archiving PSPDFKit (simulator)"
81 | run "xcrun xcodebuild -destination 'generic/platform=iOS Simulator' -archivePath #{ARCHIVE_PATH_SIMULATOR} #{XCODE_FLAGS}", :time => true, :quiet => true
82 | end
83 |
84 | desc "Archive PDFXKit (device)"
85 | task 'compile:device' => [:prepare] do
86 | tell "Archiving PSPDFKit (device)"
87 | run "xcrun xcodebuild -destination 'generic/platform=iOS' -archivePath #{ARCHIVE_PATH_DEVICE} #{XCODE_FLAGS}", :time => true, :quiet => true
88 | end
89 |
90 | desc "Archive PDFXKit (Mac Catalyst)"
91 | task 'compile:catalyst' => [:prepare] do
92 | tell "Archiving PSPDFKit (Mac Catalyst)"
93 | run "xcrun xcodebuild -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath #{ARCHIVE_PATH_MAC_CATALYST} #{XCODE_FLAGS}", :time => true, :quiet => true
94 | end
95 |
96 | desc "Creating the PDFXKit XCFramework"
97 | task :compile => ['clean', 'compile:simulator', 'compile:device', 'compile:catalyst'] do
98 | tell "Creating the PDFXKit XCFramework"
99 | uuids = uuid("#{ARCHIVE_PATH_DEVICE}/Products/Library/Frameworks/PDFXKit.framework/PDFXKit")
100 | uuid = uuids["arm64"]
101 | bcsymbolmap = "#{uuid}.bcsymbolmap"
102 | run "xcodebuild -create-xcframework -framework #{ARCHIVE_PATH_SIMULATOR}/Products/Library/Frameworks/PDFXKit.framework -debug-symbols #{ARCHIVE_PATH_SIMULATOR}/dSYMs/PDFXKit.framework.dSYM -framework #{ARCHIVE_PATH_DEVICE}/Products/Library/Frameworks/PDFXKit.framework -debug-symbols #{ARCHIVE_PATH_DEVICE}/dSYMs/PDFXKit.framework.dSYM -debug-symbols #{ARCHIVE_PATH_DEVICE}/BCSymbolMaps/#{bcsymbolmap} -framework #{ARCHIVE_PATH_MAC_CATALYST}/Products/Library/Frameworks/PDFXKit.framework -debug-symbols #{ARCHIVE_PATH_MAC_CATALYST}/dSYMs/PDFXKit.framework.dSYM -output #{DIRECTORY}/PDFXKit.xcframework"
103 | end
104 |
105 | desc "show help"
106 | task :help do
107 | run "rake -T", :silent => true
108 | end
109 |
110 | task :clean do
111 | tell "Cleaning"
112 | run "rm -rf #{DIRECTORY}", :log => false
113 | end
114 |
115 | task :prepare do
116 | tell "Preparing"
117 | run "mkdir -p #{DIRECTORY}", :log => false
118 | end
119 |
120 | # ----------------------------------------------------------- Functions ------
121 |
122 | def assert(condition, message = "")
123 | unless condition
124 | puts message + "\n\n"
125 | exit 1
126 | end
127 | end
128 |
129 | def check(condition)
130 | unless condition
131 | puts FAILED
132 | exit 1
133 | end
134 | end
135 |
136 | def run(command, options = {})
137 | system_options = {}
138 | system_options[:out] = File::NULL if options[:quiet] && !VERBOSE
139 | system_options[:err] = File::NULL if options[:quiet] && !VERBOSE
140 |
141 | success = false
142 |
143 | duration = measure do
144 | success = system("set -e; set -u; set -o pipefail; #{command}", system_options)
145 | check success unless options[:survive]
146 | end
147 |
148 | puts "Finished in #{duration}" if options[:time]
149 | success
150 | end
151 |
152 | def uuid(binary)
153 | # dwarfdump output:
154 | # UUID: 9EF74434-5B52-377F-BE1F-10D2C4F66BD1 (arm64) Build/Xcode/Archives/PDFXKit.framework-ios-arm64.xcarchive/Products/Library/Frameworks/PDFXKit.framework/PDFXKit
155 | dwarfdump = %x[dwarfdump -u #{binary}].lines
156 | uuids = dwarfdump.map { |line| line.split[1] }
157 | archs = dwarfdump.map do |line|
158 | archs = line.split[2]
159 | # Remove brackets by removing first and last character
160 | archs[1..-2]
161 | end
162 |
163 | # Use architectures as keys and UUIDs as values
164 | Hash[archs.zip(uuids)]
165 | end
166 |
167 | def put(string)
168 | print(string)
169 | STDOUT.flush
170 | end
171 |
172 | def log(message)
173 | puts message if VERBOSE
174 | end
175 |
176 | def tell(message)
177 | puts "#{BLUE}==>#{RESET} #{WHITE}#{message}#{RESET}"
178 | end
179 |
180 | def ask(message)
181 | put message + " [y/n] "
182 | answer = STDIN.getc
183 | puts "\n"
184 | %w[y n].include?(answer) ? answer : ask(message)
185 | end
186 |
187 | def read(file_path)
188 | File.open(file_path, "r", &:read)
189 | end
190 |
191 | def write(file_path, string)
192 | log "Writing file: #{file_path}"
193 | File.open(file_path, "w") { |file| file.write string }
194 | end
195 |
196 | def replace(string, with:, in:)
197 | file_path = binding.local_variable_get(:in)
198 | content = read file_path
199 | content.gsub!(string, with)
200 | write file_path, content
201 | end
202 |
203 | def measure
204 | start_time = Time.new
205 | yield
206 | end_time = Time.new
207 | duration(end_time - start_time)
208 | end
209 |
210 | def duration(total_seconds)
211 | hours = (total_seconds / 60.0 / 60.0).floor
212 | minutes = (total_seconds / 60.0 - hours * 60.0).floor
213 | seconds = (total_seconds - hours * 60.0 * 60.0 - minutes * 60.0).round
214 |
215 | duration = "#{seconds} seconds"
216 | duration = "#{minutes} minutes, #{duration}" if minutes.positive? || hours.positive?
217 | duration = "#{hours} hours, #{duration}" if hours.positive?
218 |
219 | duration
220 | end
221 |
222 | def invoke(task, *arguments)
223 | Rake::Task[task].invoke(*arguments)
224 | end
225 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #import
13 | #import
14 | #else
15 | #import "PDFXPlatform.h"
16 | #import "PDFXViewDelegate.h"
17 | #import "PDFXDocument.h"
18 | #import "PDFXPage.h"
19 | #endif
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @class PDFXDestination;
24 | @class PDFXSelection;
25 | @class PDFXAction;
26 |
27 | typedef NS_ENUM(NSInteger, PDFXDisplayDirection) {
28 | kPDFXDisplayDirectionVertical = 0,
29 | kPDFXDisplayDirectionHorizontal = 1,
30 | };
31 |
32 | typedef NS_ENUM(NSInteger, PDFXDisplayMode) {
33 | kPDFXDisplaySinglePage = 0,
34 | kPDFXDisplaySinglePageContinuous = 1,
35 | kPDFXDisplayTwoUp = 2,
36 | kPDFXDisplayTwoUpContinuous = 3
37 | };
38 |
39 | typedef NS_ENUM(NSInteger, PDFXInterpolationQuality) {
40 | kPDFXInterpolationQualityNone = 0,
41 | kPDFXInterpolationQualityLow = 1,
42 | kPDFXInterpolationQualityHigh = 2
43 | };
44 |
45 | typedef NS_OPTIONS(NSInteger, PDFXAreaOfInterest) {
46 | kPDFXNoArea = 0,
47 | kPDFXPageArea = 1ul << 0,
48 | kPDFXTextArea = 1ul << 1,
49 | kPDFXAnnotationArea = 1ul << 2,
50 | kPDFXLinkArea = 1ul << 3,
51 | kPDFXControlArea = 1ul << 4,
52 | kPDFXTextFieldArea = 1ul << 5,
53 | kPDFXIconArea = 1ul << 6,
54 | kPDFXPopupArea = 1ul << 7,
55 | kPDFXImageArea = 1ul << 8
56 | };
57 |
58 | PDFX_EXTERN NSNotificationName const PDFXViewDocumentChangedNotification;
59 | PDFX_EXTERN NSNotificationName const PDFXViewChangedHistoryNotification;
60 | PDFX_EXTERN NSNotificationName const PDFXViewPageChangedNotification;
61 | PDFX_EXTERN NSNotificationName const PDFXViewScaleChangedNotification;
62 | PDFX_EXTERN NSNotificationName const PDFXViewAnnotationHitNotification;
63 | PDFX_EXTERN NSNotificationName const PDFXViewCopyPermissionNotification;
64 | PDFX_EXTERN NSNotificationName const PDFXViewPrintPermissionNotification;
65 | PDFX_EXTERN NSNotificationName const PDFXViewAnnotationWillHitNotification;
66 | PDFX_EXTERN NSNotificationName const PDFXViewSelectionChangedNotification;
67 | PDFX_EXTERN NSNotificationName const PDFXViewDisplayModeChangedNotification;
68 | PDFX_EXTERN NSNotificationName const PDFXViewDisplayBoxChangedNotification;
69 | PDFX_EXTERN NSNotificationName const PDFXViewVisiblePagesChangedNotification;
70 |
71 | @interface PDFXView : PDFXPlatformView
72 |
73 | /// @name Associating a Document
74 |
75 | @property (nonatomic, retain, nullable) PDFXDocument *document;
76 |
77 | /// @name Setting the Delegate
78 |
79 | @property (nonatomic, weak, nullable) id delegate;
80 |
81 | /// @name Navigating to Pages
82 |
83 | @property (nonatomic, readonly, nullable) PDFXPage *currentPage PDFX_NOT_IMPLEMENTED_PRIORITY_HIGH;
84 | - (void)goToPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_HIGH;
85 |
86 | @property (nonatomic, readonly) BOOL canGoBack PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
87 | - (IBAction)goBack:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
88 |
89 | @property (nonatomic, readonly) BOOL canGoForward PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
90 | - (IBAction)goForward:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
91 |
92 | @property (nonatomic, readonly) BOOL canGoToNextPage PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
93 | - (IBAction)goToNextPage:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
94 |
95 | @property (nonatomic, readonly) BOOL canGoToPreviousPage PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
96 | - (IBAction)goToPreviousPage:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
97 |
98 | @property (nonatomic, readonly) BOOL canGoToFirstPage PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
99 | - (IBAction)goToFirstPage:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
100 |
101 | @property (nonatomic, readonly) BOOL canGoToLastPage PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
102 | - (IBAction)goToLastPage:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
103 |
104 | /// @name Navigating to Destinations
105 |
106 | @property (nonatomic, readonly, nullable) PDFXDestination *currentDestination PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_LOW("Only the current page is specified for the destination, point and zoom are set to kPDFXDestinationUnspecifiedValue");
107 | - (void)goToDestination:(PDFXDestination *)destination PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_LOW("The point and zoom properties ignored.");
108 |
109 | /// @name Navigating to Selections & Rects
110 |
111 | - (void)goToSelection:(PDFXSelection *)selection PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_MEDIUM("Only selections returned by find calls are currently fully supported (otherwise this goes to the first page of the selection)");
112 | - (void)goToRect:(PDFXRect)rect onPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
113 |
114 | /// @name Working with Display Modes and Characteristics
115 |
116 | @property (nonatomic) PDFXDisplayBox displayBox PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
117 | @property (nonatomic) PDFXDisplayMode displayMode;
118 | @property (nonatomic) PDFXDisplayDirection displayDirection;
119 |
120 | @property (nonatomic) BOOL displaysPageBreaks PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
121 | @property (nonatomic) PDFXEdgeInsets pageBreakMargins PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
122 |
123 | @property (nonatomic) BOOL displaysAsBook;
124 | @property (nonatomic) BOOL displaysRTL PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
125 |
126 | @property (nonatomic) PDFXInterpolationQuality interpolationQuality PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
127 | @property (nonatomic, strong) PDFXColor *backgroundColor;
128 |
129 | /// @name Using Page View Controller
130 |
131 | - (void)usePageViewController:(BOOL)enable withViewOptions:(nullable NSDictionary*)viewOptions PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
132 | @property (nonatomic, readonly) BOOL isUsingPageViewController PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
133 |
134 | /// @name Scaling the View
135 |
136 | @property (nonatomic) BOOL autoScales PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
137 |
138 | @property (nonatomic) CGFloat scaleFactor PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
139 | @property (nonatomic, readonly) CGFloat scaleFactorForSizeToFit PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
140 |
141 | @property (nonatomic) CGFloat minScaleFactor PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
142 | @property (nonatomic) CGFloat maxScaleFactor PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
143 |
144 | /// @name Zooming
145 |
146 | @property (nonatomic, readonly) BOOL canZoomIn PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
147 | - (IBAction)zoomIn:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
148 |
149 | @property (nonatomic, readonly) BOOL canZoomOut PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
150 | - (IBAction)zoomOut:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
151 |
152 | /// @name Areas of Interest
153 |
154 | - (PDFXAreaOfInterest)areaOfInterestForMouse:(PDFXEvent *)event PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
155 | - (PDFXAreaOfInterest)areaOfInterestForPoint:(PDFXPoint)cursorLocation PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
156 |
157 | /// @name Performing Actions
158 |
159 | - (void)performAction:(PDFXAction *)action PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
160 |
161 | /// @name Managing Selections
162 |
163 | @property (nonatomic, strong, nullable) PDFXSelection *currentSelection PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
164 | - (void)setCurrentSelection:(nullable PDFXSelection *)selection animate:(BOOL)animate PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
165 |
166 | - (void)clearSelection PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
167 | - (IBAction)selectAll:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
168 | - (IBAction)scrollSelectionToVisible:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
169 |
170 | @property (nonatomic, copy, nullable) NSArray *highlightedSelections PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
171 |
172 | /// @name Drawing
173 |
174 | - (void)drawPage:(PDFXPage *)page toContext:(CGContextRef)context PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
175 | - (void)drawPagePost:(PDFXPage *)page toContext:(CGContextRef)context PDFX_NOT_IMPLEMENTED_PRIORITY_MEDIUM;
176 |
177 | /// @name Copy & Paste
178 |
179 | - (IBAction)copy:(nullable id)sender PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
180 |
181 | /// @name Conversion Methods for Subclasses
182 |
183 | - (nullable PDFXPage *)pageForPoint:(PDFXPoint)point nearest:(BOOL)nearest PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
184 | - (PDFXPoint)convertPoint:(PDFXPoint)point toPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
185 | - (PDFXRect)convertRect:(PDFXRect)rect toPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
186 | - (PDFXPoint)convertPoint:(PDFXPoint)point fromPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
187 | - (PDFXRect)convertRect:(PDFXRect)rect fromPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
188 |
189 | /// @name Other Stuff
190 |
191 | @property (nonatomic, readonly, nullable) UIView *documentView PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
192 | - (void)layoutDocumentView PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
193 |
194 | - (void)annotationsChangedOnPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
195 | - (PDFXSize)rowSizeForPage:(PDFXPage *)page PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
196 |
197 | @property (nonatomic, readonly) NSArray *visiblePages PDFX_NOT_IMPLEMENTED_PRIORITY_HIGH;
198 | @property (nonatomic) BOOL enableDataDetectors PDFX_NOT_IMPLEMENTED_PRIORITY_LOW;
199 |
200 | @end
201 |
202 | NS_ASSUME_NONNULL_END
203 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXAnnotation.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXAnnotation+PSPDFKit.h"
10 | #import "PDFXPlatform+Private.h"
11 | #import "PSPDFKit+PDFXKit.h"
12 |
13 | PDFXAnnotationKey PDFXAnnotationKeyAppearanceDictionary = @"/AP";
14 | PDFXAnnotationKey PDFXAnnotationKeyAppearanceState = @"/AS";
15 | PDFXAnnotationKey PDFXAnnotationKeyBorder = @"/Border";
16 | PDFXAnnotationKey PDFXAnnotationKeyColor = @"/C";
17 | PDFXAnnotationKey PDFXAnnotationKeyContents = @"/Contents";
18 | PDFXAnnotationKey PDFXAnnotationKeyDate = @"/M";
19 | PDFXAnnotationKey PDFXAnnotationKeyFlags = @"/F";
20 | PDFXAnnotationKey PDFXAnnotationKeyName = @"/NM";
21 | PDFXAnnotationKey PDFXAnnotationKeyPage = @"/P";
22 | PDFXAnnotationKey PDFXAnnotationKeyRect = @"/Rect";
23 | PDFXAnnotationKey PDFXAnnotationKeySubtype = @"/Subtype";
24 |
25 | PDFXAnnotationKey PDFXAnnotationKeyAction = @"/A";
26 | PDFXAnnotationKey PDFXAnnotationKeyAdditionalActions = @"/AA";
27 | PDFXAnnotationKey PDFXAnnotationKeyBorderStyle = @"/BS";
28 | PDFXAnnotationKey PDFXAnnotationKeyDefaultAppearance = @"/DA";
29 | PDFXAnnotationKey PDFXAnnotationKeyDestination = @"/Dest";
30 | PDFXAnnotationKey PDFXAnnotationKeyHighlightingMode = @"/H";
31 | PDFXAnnotationKey PDFXAnnotationKeyIconName = @"/Name";
32 | PDFXAnnotationKey PDFXAnnotationKeyInklist = @"/InkList";
33 | PDFXAnnotationKey PDFXAnnotationKeyInteriorColor = @"/IC";
34 | PDFXAnnotationKey PDFXAnnotationKeyLineEndingStyles = @"/LE";
35 | PDFXAnnotationKey PDFXAnnotationKeyLinePoints = @"/L";
36 | PDFXAnnotationKey PDFXAnnotationKeyOpen = @"/Open";
37 | PDFXAnnotationKey PDFXAnnotationKeyParent = @"/Parent";
38 | PDFXAnnotationKey PDFXAnnotationKeyPopup = @"/Popup";
39 | PDFXAnnotationKey PDFXAnnotationKeyQuadding = @"/Q";
40 | PDFXAnnotationKey PDFXAnnotationKeyQuadPoints = @"/QuadPoints";
41 | PDFXAnnotationKey PDFXAnnotationKeyTextLabel = @"/T";
42 |
43 | PDFXAnnotationKey PDFXAnnotationKeyWidgetAppearanceDictionary = @"/MK";
44 | PDFXAnnotationKey PDFXAnnotationKeyWidgetBackgroundColor = @"/BG";
45 | PDFXAnnotationKey PDFXAnnotationKeyWidgetBorderColor = @"/BC";
46 | PDFXAnnotationKey PDFXAnnotationKeyWidgetCaption = @"/CA";
47 | PDFXAnnotationKey PDFXAnnotationKeyWidgetDefaultValue = @"/DV";
48 | PDFXAnnotationKey PDFXAnnotationKeyWidgetDownCaption = @"/AC";
49 | PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldFlags = @"/Ff";
50 | PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldType = @"/FT";
51 | PDFXAnnotationKey PDFXAnnotationKeyWidgetMaxLen = @"/MaxLen";
52 | PDFXAnnotationKey PDFXAnnotationKeyWidgetOptions = @"/Opt";
53 | PDFXAnnotationKey PDFXAnnotationKeyWidgetRolloverCaption = @"/RC";
54 | PDFXAnnotationKey PDFXAnnotationKeyWidgetRotation = @"/R";
55 | PDFXAnnotationKey PDFXAnnotationKeyWidgetTextLabelUI = @"/TU";
56 | PDFXAnnotationKey PDFXAnnotationKeyWidgetValue = @"/V";
57 |
58 | PDFXAnnotationSubtype PDFXAnnotationSubtypeCircle = @"/Circle";
59 | PDFXAnnotationSubtype PDFXAnnotationSubtypeFreeText = @"/FreeText";
60 | PDFXAnnotationSubtype PDFXAnnotationSubtypeHighlight = @"/Highlight";
61 | PDFXAnnotationSubtype PDFXAnnotationSubtypeInk = @"/Ink";
62 | PDFXAnnotationSubtype PDFXAnnotationSubtypeLine = @"/Line";
63 | PDFXAnnotationSubtype PDFXAnnotationSubtypeLink = @"/Link";
64 | PDFXAnnotationSubtype PDFXAnnotationSubtypePopup = @"/Popup";
65 | PDFXAnnotationSubtype PDFXAnnotationSubtypeSquare = @"/Square";
66 | PDFXAnnotationSubtype PDFXAnnotationSubtypeStamp = @"/Stamp";
67 | PDFXAnnotationSubtype PDFXAnnotationSubtypeStrikeOut = @"/StrikeOut";
68 | PDFXAnnotationSubtype PDFXAnnotationSubtypeText = @"/Text";
69 | PDFXAnnotationSubtype PDFXAnnotationSubtypeUnderline = @"/Underline";
70 | PDFXAnnotationSubtype PDFXAnnotationSubtypeWidget = @"/Widget";
71 |
72 | PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeButton = @"/Btn";
73 | PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeChoice = @"/Ch";
74 | PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeSignature = @"/Sig";
75 | PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeText = @"/Tx";
76 |
77 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleCircle = @"/Circle";
78 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleClosedArrow = @"/ClosedArrow";
79 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleDiamond = @"/Diamond";
80 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleNone = @"/None";
81 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleOpenArrow = @"/OpenArrow";
82 | PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleSquare = @"/Square";
83 |
84 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeComment = @"/Comment";
85 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeHelp = @"/Help";
86 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeInsert = @"/Insert";
87 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeKey = @"/Key";
88 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNewParagraph = @"/NewParagraph";
89 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNote = @"/Note";
90 | PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeParagraph = @"/Paragraph";
91 |
92 | PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeInvert = @"/I";
93 | PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeNone = @"/N";
94 | PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeOutline = @"/O";
95 | PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModePush = @"/P";
96 |
97 | @implementation PDFXAnnotation
98 |
99 | #pragma mark - Initializing an Annotation
100 |
101 | - (instancetype)initWithBounds:(PDFXRect)bounds forType:(PDFXAnnotationSubtype)annotationType withProperties:(nullable NSDictionary*)properties {
102 | if ((self = [super init])) {
103 | // TODO: implement.
104 | }
105 | return self;
106 | }
107 |
108 | #pragma mark - Accessing Information About an Annotation
109 |
110 | // @property (nonatomic, weak, nullable) PDFXPage *page;
111 | // @property (nonatomic, copy, nullable) NSString *userName;
112 | //
113 | // @property (nonatomic, copy, nullable) NSDate *modificationDate;
114 | // @property (nonatomic, strong, nullable) PDFXAnnotationPopup *popup;
115 | //
116 | // @property (nonatomic, copy, nullable) NSString *type;
117 |
118 | #pragma mark - Managing Annotation Display Characteristics
119 |
120 | // @property (nonatomic) PDFXRect bounds;
121 |
122 | - (BOOL)hasAppearanceStream {
123 | // TODO: implement.
124 | return NO;
125 | }
126 |
127 | // @property (nonatomic, strong, nullable) PDFXBorder *border;
128 | // @property (nonatomic, copy) PDFXColor *color;
129 |
130 | #pragma mark - Managing Annotation Drawing and Output
131 |
132 | // @property (nonatomic) BOOL shouldDisplay;
133 | // @property (nonatomic) BOOL shouldPrint;
134 |
135 | - (void)drawWithBox:(PDFXDisplayBox)box inContext:(CGContextRef)context {
136 | // TODO: implement.
137 | }
138 |
139 | #pragma mark - Working With Attributes
140 |
141 | // @property (nonatomic, readonly, copy) NSDictionary *annotationKeyValues;
142 |
143 | - (BOOL)setBoolean:(BOOL)value forAnnotationKey:(PDFXAnnotationKey)key {
144 | // TODO: implement.
145 | return NO;
146 | }
147 |
148 | - (BOOL)setRect:(PDFXRect)value forAnnotationKey:(PDFXAnnotationKey)key {
149 | // TODO: implement.
150 | return NO;
151 | }
152 |
153 | - (nullable id)valueForAnnotationKey:(PDFXAnnotationKey)key {
154 | // TODO: implement.
155 | return nil;
156 | }
157 |
158 | - (BOOL)setValue:(id)value forAnnotationKey:(PDFXAnnotationKey)key {
159 | // TODO: implement.
160 | return NO;
161 | }
162 |
163 | - (void)removeValueForAnnotationKey:(PDFXAnnotationKey)key {
164 | // TODO: implement.
165 | }
166 |
167 | #pragma mark - Miscellaneous
168 |
169 | // @property (nonatomic, copy, nullable) NSString *contents;
170 | // @property (nonatomic, strong, nullable) PDFXAction *action;
171 | // @property (nonatomic, getter = isHighlighted) BOOL highlighted;
172 |
173 | #pragma mark - Utilities
174 |
175 | // @property (nonatomic, copy, nullable) PDFXFont *font;
176 | // @property (nonatomic, copy, nullable) PDFXColor *fontColor;
177 |
178 | // @property (nonatomic) NSTextAlignment alignment;
179 |
180 | // @property (nonatomic) PDFXPoint startPoint;
181 | // @property (nonatomic) PDFXPoint endPoint;
182 |
183 | // @property (nonatomic) PDFXLineStyle startLineStyle;
184 | // @property (nonatomic) PDFXLineStyle endLineStyle;
185 |
186 | + (PDFXLineStyle)lineStyleFromName:(NSString *)name {
187 | // TODO: implement.
188 | return kPDFXLineStyleNone;
189 | }
190 |
191 | + (NSString *)nameForLineStyle:(PDFXLineStyle)style {
192 | // TODO: implement.
193 | return @"";
194 | }
195 |
196 | // @property (nonatomic) PDFXTextAnnotationIconType iconType;
197 | // @property (nonatomic, copy, nullable) NSArray *quadrilateralPoints;
198 |
199 | // @property (nonatomic) PDFXMarkupType markupType;
200 | // @property (nonatomic, copy) PDFXAnnotationWidgetSubtype widgetFieldType;
201 |
202 | // @property (nonatomic) PDFXWidgetControlType widgetControlType;
203 | // @property (nonatomic, getter = isMultiline) BOOL multiline;
204 |
205 | - (BOOL)isPasswordField {
206 | // TODO: implement.
207 | return NO;
208 | }
209 |
210 | // @property (nonatomic, getter = hasComb) BOOL comb;
211 | // @property (nonatomic) NSInteger maximumLength;
212 |
213 | // @property (nonatomic, copy, nullable) NSString *widgetStringValue;
214 | // @property (nonatomic, copy, nullable) NSString *widgetDefaultStringValue;
215 |
216 | // @property (nonatomic) BOOL allowsToggleToOff;
217 | // @property (nonatomic) BOOL radiosInUnison;
218 |
219 | // @property (nonatomic, getter = isReadOnly) BOOL readOnly;
220 | // @property (nonatomic, getter = isListChoice) BOOL listChoice;
221 |
222 | // @property (nonatomic, copy, nullable) NSArray *choices;
223 | // @property (nonatomic, copy, nullable) NSArray *values;
224 |
225 | // @property (nonatomic) PDFXWidgetCellState buttonWidgetState;
226 | // @property (nonatomic, copy) NSString *buttonWidgetStateString;
227 |
228 | // @property (nonatomic, getter = isOpen) BOOL open;
229 |
230 | - (NSArray *)paths {
231 | // TODO: implement.
232 | return @[];
233 | }
234 |
235 | - (void)addBezierPath:(PDFXBezierPath *)path {
236 | // TODO: implement.
237 | }
238 |
239 | - (void)removeBezierPath:(PDFXBezierPath *)path {
240 | // TODO: implement.
241 | }
242 |
243 | // @property (nonatomic, strong, nullable) PDFXDestination *destination;
244 | // @property (nonatomic, copy, nullable) NSURL *URL;
245 |
246 | // @property (nonatomic, copy, nullable) NSString *fieldName;
247 | // @property (nonatomic, copy, nullable) NSString *caption;
248 |
249 | // @property (nonatomic, copy, nullable) PDFXColor *backgroundColor;
250 |
251 | #pragma mark - NSCopying
252 |
253 | - (id)copyWithZone:(NSZone *)zone {
254 | // TODO: implement.
255 | return [self.class new];
256 | }
257 |
258 | #pragma mark - NSCoding
259 |
260 | - (void)encodeWithCoder:(nonnull NSCoder *)aCoder {
261 | // TODO: implement.
262 | }
263 |
264 | - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder {
265 | // TODO: implement.
266 | return nil;
267 | }
268 |
269 | @end
270 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/Public/PDFXAnnotation.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #if FRAMEWORK_BUILD
10 | #import
11 | #import
12 | #else
13 | #import "PDFXPlatform.h"
14 | #import "PDFXPage.h"
15 | #endif
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | @class PDFXAction;
20 | @class PDFXAnnotationPopup;
21 | @class PDFXBorder;
22 | @class PDFXDestination;
23 |
24 | typedef NS_ENUM(NSInteger, PDFXLineStyle) {
25 | kPDFXLineStyleNone = 0,
26 | kPDFXLineStyleSquare = 1,
27 | kPDFXLineStyleCircle = 2,
28 | kPDFXLineStyleDiamond = 3,
29 | kPDFXLineStyleOpenArrow = 4,
30 | kPDFXLineStyleClosedArrow = 5
31 | };
32 |
33 | typedef NS_ENUM(NSInteger, PDFXMarkupType) {
34 | kPDFXMarkupTypeHighlight = 0,
35 | kPDFXMarkupTypeStrikeOut = 1,
36 | kPDFXMarkupTypeUnderline = 2
37 | };
38 |
39 | typedef NS_ENUM(NSInteger, PDFXTextAnnotationIconType) {
40 | kPDFXTextAnnotationIconComment = 0,
41 | kPDFXTextAnnotationIconKey = 1,
42 | kPDFXTextAnnotationIconNote = 2,
43 | kPDFXTextAnnotationIconHelp = 3,
44 | kPDFXTextAnnotationIconNewParagraph = 4,
45 | kPDFXTextAnnotationIconParagraph = 5,
46 | kPDFXTextAnnotationIconInsert = 6
47 | };
48 |
49 | typedef NS_ENUM(NSInteger, PDFXWidgetCellState) {
50 | kPDFXWidgetMixedState = -1,
51 | kPDFXWidgetOffState = 0,
52 | kPDFXWidgetOnState = 1,
53 | };
54 |
55 | typedef NS_ENUM(NSInteger, PDFXWidgetControlType) {
56 | kPDFXWidgetUnknownControl = -1,
57 | kPDFXWidgetPushButtonControl = 0,
58 | kPDFXWidgetRadioButtonControl = 1,
59 | kPDFXWidgetCheckBoxControl = 2
60 | };
61 |
62 | typedef NSString *const PDFXAnnotationKey NS_STRING_ENUM;
63 | typedef NSString *const PDFXAnnotationSubtype NS_STRING_ENUM;
64 | typedef NSString *const PDFXAnnotationWidgetSubtype NS_STRING_ENUM;
65 | typedef NSString *const PDFXAnnotationLineEndingStyle NS_STRING_ENUM;
66 | typedef NSString *const PDFXAnnotationTextIconType NS_STRING_ENUM;
67 | typedef NSString *const PDFXAnnotationHighlightingMode NS_STRING_ENUM;
68 |
69 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyAppearanceDictionary;
70 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyAppearanceState;
71 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyBorder;
72 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyColor;
73 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyContents;
74 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyDate;
75 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyFlags;
76 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyName;
77 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyPage;
78 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyRect;
79 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeySubtype;
80 |
81 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyAction;
82 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyAdditionalActions;
83 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyBorderStyle;
84 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyDefaultAppearance;
85 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyDestination;
86 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyHighlightingMode;
87 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyIconName;
88 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyInklist;
89 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyInteriorColor;
90 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyLineEndingStyles;
91 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyLinePoints;
92 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyOpen;
93 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyParent;
94 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyPopup;
95 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyQuadding;
96 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyQuadPoints;
97 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyTextLabel;
98 |
99 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetAppearanceDictionary;
100 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetBackgroundColor;
101 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetBorderColor;
102 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetCaption;
103 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetDefaultValue;
104 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetDownCaption;
105 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldFlags;
106 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldType;
107 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetMaxLen;
108 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetOptions;
109 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetRolloverCaption;
110 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetRotation;
111 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetTextLabelUI;
112 | PDFX_EXTERN PDFXAnnotationKey PDFXAnnotationKeyWidgetValue;
113 |
114 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeCircle;
115 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeFreeText;
116 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeHighlight;
117 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeInk;
118 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeLine;
119 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeLink;
120 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypePopup;
121 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeSquare;
122 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeStamp;
123 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeStrikeOut;
124 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeText;
125 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeUnderline;
126 | PDFX_EXTERN PDFXAnnotationSubtype PDFXAnnotationSubtypeWidget;
127 |
128 | PDFX_EXTERN PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeButton;
129 | PDFX_EXTERN PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeChoice;
130 | PDFX_EXTERN PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeSignature;
131 | PDFX_EXTERN PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeText;
132 |
133 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleCircle;
134 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleClosedArrow;
135 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleDiamond;
136 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleNone;
137 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleOpenArrow;
138 | PDFX_EXTERN PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleSquare;
139 |
140 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeComment;
141 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeHelp;
142 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeInsert;
143 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeKey;
144 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNewParagraph;
145 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNote;
146 | PDFX_EXTERN PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeParagraph;
147 |
148 | PDFX_EXTERN PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeInvert;
149 | PDFX_EXTERN PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeNone;
150 | PDFX_EXTERN PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeOutline;
151 | PDFX_EXTERN PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModePush;
152 |
153 | @interface PDFXAnnotation : NSObject
154 |
155 | /// @name Initializing an Annotation
156 |
157 | - (instancetype)initWithBounds:(PDFXRect)bounds forType:(PDFXAnnotationSubtype)annotationType withProperties:(nullable NSDictionary*)properties PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
158 |
159 | /// @name Accessing Information About an Annotation
160 |
161 | @property (nonatomic, weak, nullable) PDFXPage *page PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
162 | @property (nonatomic, copy, nullable) NSString *userName PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
163 |
164 | @property (nonatomic, copy, nullable) NSDate *modificationDate PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
165 | @property (nonatomic, strong, nullable) PDFXAnnotationPopup *popup PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
166 |
167 | @property (nonatomic, copy, nullable) NSString *type PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
168 |
169 | /// @name Managing Annotation Display Characteristics
170 |
171 | @property (nonatomic) PDFXRect bounds PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
172 | @property (nonatomic, readonly) BOOL hasAppearanceStream PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
173 |
174 | @property (nonatomic, strong, nullable) PDFXBorder *border PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
175 | @property (nonatomic, copy) PDFXColor *color PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
176 |
177 | /// @name Managing Annotation Drawing and Output
178 |
179 | @property (nonatomic) BOOL shouldDisplay PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
180 | @property (nonatomic) BOOL shouldPrint PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
181 |
182 | - (void)drawWithBox:(PDFXDisplayBox)box inContext:(CGContextRef)context PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
183 |
184 | /// @name Working With Attributes
185 |
186 | @property (nonatomic, readonly, copy) NSDictionary *annotationKeyValues PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
187 |
188 | - (BOOL)setBoolean:(BOOL)value forAnnotationKey:(PDFXAnnotationKey)key PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
189 | - (BOOL)setRect:(PDFXRect)value forAnnotationKey:(PDFXAnnotationKey)key PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
190 |
191 | - (nullable id)valueForAnnotationKey:(PDFXAnnotationKey)key PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
192 | - (BOOL)setValue:(id)value forAnnotationKey:(PDFXAnnotationKey)key PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
193 |
194 | - (void)removeValueForAnnotationKey:(PDFXAnnotationKey)key PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
195 |
196 | /// @name Miscellaneous
197 |
198 | @property (nonatomic, copy, nullable) NSString *contents PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
199 | @property (nonatomic, strong, nullable) PDFXAction *action PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
200 | @property (nonatomic, getter = isHighlighted) BOOL highlighted PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
201 |
202 | /// @name Utilities
203 |
204 | @property (nonatomic, copy, nullable) PDFXFont *font PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
205 | @property (nonatomic, copy, nullable) PDFXColor *fontColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
206 |
207 | @property (nonatomic) NSTextAlignment alignment PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
208 |
209 | @property (nonatomic) PDFXPoint startPoint PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
210 | @property (nonatomic) PDFXPoint endPoint PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
211 |
212 | @property (nonatomic) PDFXLineStyle startLineStyle PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
213 | @property (nonatomic) PDFXLineStyle endLineStyle PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
214 |
215 | + (PDFXLineStyle)lineStyleFromName:(NSString *)name PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
216 | + (NSString *)nameForLineStyle:(PDFXLineStyle)style PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
217 |
218 | @property (nonatomic) PDFXTextAnnotationIconType iconType PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
219 | @property (nonatomic, copy, nullable) NSArray *quadrilateralPoints PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
220 |
221 | @property (nonatomic) PDFXMarkupType markupType PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
222 | @property (nonatomic, copy) PDFXAnnotationWidgetSubtype widgetFieldType PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
223 |
224 | @property (nonatomic) PDFXWidgetControlType widgetControlType PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
225 | @property (nonatomic, getter = isMultiline) BOOL multiline PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
226 |
227 | @property (nonatomic, readonly) BOOL isPasswordField PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
228 |
229 | @property (nonatomic, getter = hasComb) BOOL comb PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
230 | @property (nonatomic) NSInteger maximumLength PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
231 |
232 | @property (nonatomic, copy, nullable) NSString *widgetStringValue PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
233 | @property (nonatomic, copy, nullable) NSString *widgetDefaultStringValue PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
234 |
235 | @property (nonatomic) BOOL allowsToggleToOff PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
236 | @property (nonatomic) BOOL radiosInUnison PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
237 |
238 | @property (nonatomic, getter = isReadOnly) BOOL readOnly PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
239 | @property (nonatomic, getter = isListChoice) BOOL listChoice PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
240 |
241 | @property (nonatomic, copy, nullable) NSArray *choices PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
242 | @property (nonatomic, copy, nullable) NSArray *values PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
243 |
244 | @property (nonatomic) PDFXWidgetCellState buttonWidgetState PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
245 | @property (nonatomic, copy) NSString *buttonWidgetStateString PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
246 |
247 | @property (nonatomic, getter = isOpen) BOOL open PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
248 | @property (nonatomic, readonly, nullable) NSArray *paths PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
249 |
250 | - (void)addBezierPath:(PDFXBezierPath *)path PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
251 | - (void)removeBezierPath:(PDFXBezierPath *)path PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
252 |
253 | @property (nonatomic, strong, nullable) PDFXDestination *destination PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
254 | @property (nonatomic, copy, nullable) NSURL *URL PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
255 |
256 | @property (nonatomic, copy, nullable) NSString *fieldName PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
257 | @property (nonatomic, copy, nullable) NSString *caption PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
258 |
259 | @property (nonatomic, copy, nullable) PDFXColor *backgroundColor PDFX_NOT_IMPLEMENTED_PRIORITY_UNKNOWN;
260 |
261 | @end
262 |
263 | NS_ASSUME_NONNULL_END
264 |
--------------------------------------------------------------------------------
/Sources/PDFXKitObjC/ObjC/PDFXDocument.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import "PDFXDocument+PSPDFKit.h"
10 | #import "PDFXDocument+Swift.h"
11 |
12 | #import "PDFXOutline+PSPDFKit.h"
13 | #import "PDFXSelection+PSPDFKit.h"
14 |
15 | #import "PDFXPage+Private.h"
16 | #import "PDFXSelection+Private.h"
17 |
18 | #import "PDFXPlatform+Private.h"
19 | #import "PSPDFKit+PDFXKit.h"
20 |
21 | NSNotificationName const PDFXDocumentDidUnlockNotification = @"PDFXDocumentDidUnlock";
22 | NSNotificationName const PDFXDocumentDidBeginFindNotification = @"PDFXDidBeginDocumentFind";
23 | NSNotificationName const PDFXDocumentDidEndFindNotification = @"PDFXDidEndDocumentFind";
24 | NSNotificationName const PDFXDocumentDidBeginPageFindNotification = @"PDFXDidBeginPageFind";
25 | NSNotificationName const PDFXDocumentDidEndPageFindNotification = @"PDFXDidEndPageFind";
26 | NSNotificationName const PDFXDocumentDidFindMatchNotification = @"PDFXDidFindMatch";
27 | NSNotificationName const PDFXDocumentDidBeginWriteNotification = @"PDFXDidBeginDocumentWrite";
28 | NSNotificationName const PDFXDocumentDidEndWriteNotification = @"PDFXDidEndDocumentWrite";
29 | NSNotificationName const PDFXDocumentDidBeginPageWriteNotification = @"PDFXDidBeginPageWrite";
30 | NSNotificationName const PDFXDocumentDidEndPageWriteNotification = @"PDFXDidEndPageWrite";
31 |
32 | PDFXDocumentAttribute PDFXDocumentAuthorAttribute = @"Author";
33 | PDFXDocumentAttribute PDFXDocumentCreationDateAttribute = @"CreationDate";
34 | PDFXDocumentAttribute PDFXDocumentCreatorAttribute = @"Creator";
35 | PDFXDocumentAttribute PDFXDocumentKeywordsAttribute = @"Keywords";
36 | PDFXDocumentAttribute PDFXDocumentModificationDateAttribute = @"ModDate";
37 | PDFXDocumentAttribute PDFXDocumentProducerAttribute = @"Producer";
38 | PDFXDocumentAttribute PDFXDocumentSubjectAttribute = @"Subject";
39 | PDFXDocumentAttribute PDFXDocumentTitleAttribute = @"Title";
40 |
41 | PDFXDocumentWriteOption PDFXDocumentOwnerPasswordOption = @"PDFDocumentOwnerPasswordOption";
42 | PDFXDocumentWriteOption PDFXDocumentUserPasswordOption = @"PDFDocumentUserPasswordOption";
43 |
44 | @interface PDFXDocument ()
45 |
46 | @property (nonatomic, strong) NSArray *pages;
47 |
48 | @end
49 |
50 | @implementation PDFXDocument
51 |
52 | #pragma mark - Initializing Documents
53 |
54 | - (instancetype)init {
55 | let pspdfDocument = [[PSPDFDocument alloc] init];
56 | return [self initWithPSPDFDocument:pspdfDocument];
57 | }
58 |
59 | - (nullable instancetype)initWithURL:(NSURL *)url {
60 | let pspdfDocument = [[PSPDFDocument alloc] initWithURL:url];
61 | return pspdfDocument ? [self initWithPSPDFDocument:pspdfDocument] : nil;
62 | }
63 |
64 | - (nullable instancetype)initWithData:(NSData *)data {
65 | let pspdfDocument = [[PSPDFDocument alloc] initWithDataProviders:@[[[PSPDFDataContainerProvider alloc] initWithData: data]]];
66 | return pspdfDocument ? [self initWithPSPDFDocument:pspdfDocument] : nil;
67 | }
68 |
69 | #pragma mark - Accessing Document Information
70 |
71 | - (NSURL *)documentURL {
72 | return self.pspdfDocument.fileURL;
73 | }
74 |
75 | - (NSInteger)majorVersion {
76 | // TODO: implement.
77 | return 1;
78 | }
79 |
80 | - (NSInteger)minorVersion {
81 | // TODO: implement.
82 | return 0;
83 | }
84 |
85 | - (NSString *)string {
86 | // TODO: this is a brute force algorithm, make it faster.
87 | let pspdfDocument = self.pspdfDocument;
88 | let pageCount = pspdfDocument.pageCount;
89 | let string = [NSMutableString new];
90 |
91 | for (NSInteger pageIndex = 0; pageIndex < pageCount; pageIndex += 1) {
92 | let textParser = [pspdfDocument textParserForPageAtIndex:pageIndex];
93 | [string appendString:textParser.text];
94 | }
95 |
96 | return [string copy];
97 | }
98 |
99 | - (NSDictionary *)documentAttributes {
100 | let metadata = [[PSPDFDocumentPDFMetadata alloc] initWithDocument:self.pspdfDocument];
101 | let documentAttributes = [NSMutableDictionary new];
102 |
103 | let keys = @[
104 | PDFXDocumentAuthorAttribute,
105 | PDFXDocumentCreationDateAttribute,
106 | PDFXDocumentCreatorAttribute,
107 | PDFXDocumentKeywordsAttribute,
108 | PDFXDocumentModificationDateAttribute,
109 | PDFXDocumentProducerAttribute,
110 | PDFXDocumentSubjectAttribute,
111 | PDFXDocumentTitleAttribute
112 | ];
113 |
114 | for (NSString *key in keys) {
115 | id value = metadata[key];
116 | if (value != nil) {
117 | documentAttributes[key] = value;
118 | }
119 | }
120 |
121 | return [documentAttributes copy];
122 | }
123 |
124 | - (CGPDFDocumentRef)documentRef {
125 | // TODO: can we generate a CGPDFDocument here?
126 | return nil;
127 | }
128 |
129 | #pragma mark - Working with the Document Outline
130 |
131 | @synthesize outlineRoot = _outlineRoot;
132 |
133 | - (PDFXOutline *)outlineRoot {
134 | if (_outlineRoot == nil) {
135 | let pspdfOutlineElement = self.pspdfDocument.documentProviders.firstObject.outlineParser.outline;
136 | if (pspdfOutlineElement) {
137 | _outlineRoot = [[PDFXOutline alloc] initWithPSPDFOutlineElement:pspdfOutlineElement index:0 parent:nil document:self];
138 | }
139 | }
140 | return _outlineRoot;
141 | }
142 |
143 | - (void)setOutlineRoot:(PDFXOutline *)outlineRoot {
144 | // TODO: implement.
145 | }
146 |
147 | - (nullable PDFXOutline *)outlineItemForSelection:(PDFXSelection *)selection {
148 | // TODO: implement.
149 | return nil;
150 | }
151 |
152 | #pragma mark - Managing Document Security
153 |
154 | - (BOOL)isEncrypted {
155 | return self.pspdfDocument.isEncrypted;
156 | }
157 |
158 | - (BOOL)isLocked {
159 | return self.pspdfDocument.isLocked;
160 | }
161 |
162 | - (BOOL)unlockWithPassword:(NSString *)password {
163 | return [self.pspdfDocument unlockWithPassword:password];
164 | }
165 |
166 | - (BOOL)allowsPrinting {
167 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsPrinting;
168 | }
169 |
170 | - (BOOL)allowsCopying {
171 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsExtract;
172 | }
173 |
174 | -(BOOL)allowsDocumentChanges {
175 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsModification;
176 | }
177 |
178 | -(BOOL)allowsDocumentAssembly {
179 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsAssemble;
180 | }
181 |
182 | -(BOOL)allowsContentAccessibility {
183 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsExtractAccessibility;
184 | }
185 |
186 | -(BOOL)allowsCommenting {
187 | // TODO: implement.
188 | return NO;
189 | }
190 |
191 | -(BOOL)allowsFormFieldEntry {
192 | return self.pspdfDocument.permissions & PSPDFDocumentPermissionsFillForms;
193 | }
194 |
195 | - (PDFXDocumentPermissions)permissionStatus {
196 | // TODO: implement.
197 | return kPDFXDocumentPermissionsNone;
198 | }
199 |
200 | #pragma mark - Writing Out PDF Data
201 |
202 | - (nullable NSData *)dataRepresentation {
203 | return [self dataRepresentationWithOptions:@{}];
204 | }
205 |
206 | - (nullable NSData *)dataRepresentationWithOptions:(NSDictionary *)options {
207 | // TODO: implement options support.
208 | return self.pspdfDocument.data;
209 | }
210 |
211 | - (BOOL)writeToFile:(NSString *)path {
212 | return [self writeToFile:path withOptions:nil];
213 | }
214 |
215 | - (BOOL)writeToFile:(NSString *)path withOptions:(nullable NSDictionary *)options {
216 | return [self writeToURL:[NSURL URLWithString:path] withOptions:options];
217 | }
218 |
219 | - (BOOL)writeToURL:(NSURL *)url {
220 | return [self writeToURL:url withOptions:nil];
221 | }
222 |
223 | - (BOOL)writeToURL:(NSURL *)url withOptions:(nullable NSDictionary *)options {
224 | options = options ?: @{};
225 | let data = [self dataRepresentationWithOptions:options];
226 | return [data writeToURL:url atomically:YES];
227 | }
228 |
229 | #pragma mark - Working with Pages
230 |
231 | - (NSUInteger)pageCount {
232 | return self.pages.count;
233 | }
234 |
235 | - (nullable PDFXPage *)pageAtIndex:(NSUInteger)index {
236 | return [self.pages objectAtIndex:index];
237 | }
238 |
239 | - (NSUInteger)indexForPage:(PDFXPage *)page {
240 | return [self.pages indexOfObject:page];
241 | }
242 |
243 | - (void)insertPage:(PDFXPage *)page atIndex:(NSUInteger)index {
244 | // TODO: implement.
245 | }
246 |
247 | - (void)removePageAtIndex:(NSUInteger)index {
248 | // TODO: implement.
249 | }
250 |
251 | - (void)exchangePageAtIndex:(NSUInteger)indexOfPageToReplace withPageAtIndex:(NSUInteger)indexOfReplacementPage {
252 | // TODO: implement.
253 | }
254 |
255 | #pragma mark - Managing Find Operations
256 |
257 | - (NSArray *)findString:(NSString *)string withOptions:(NSStringCompareOptions)options {
258 | // TODO: implement.
259 | return @[];
260 | }
261 |
262 | - (nullable PDFXSelection *)findString:(NSString *)string fromSelection:(nullable PDFXSelection *)selection withOptions:(NSStringCompareOptions)options {
263 | // TODO: implement.
264 | return nil;
265 | }
266 |
267 | - (void)beginFindString:(NSString *)string withOptions:(NSStringCompareOptions)options {
268 | [self cancelFindString];
269 | self.pspdfTextSearch = [[PSPDFTextSearch alloc] initWithDocument:self.pspdfDocument];
270 | self.pspdfTextSearch.compareOptions = options;
271 | self.pspdfTextSearch.delegate = self;
272 | [self.pspdfTextSearch searchForString:string];
273 | }
274 |
275 | - (void)beginFindStrings:(NSArray *)strings withOptions:(NSStringCompareOptions)options {
276 | // TODO: implement.
277 | }
278 |
279 | - (BOOL)isFinding {
280 | return self.pspdfTextSearch != nil;
281 | }
282 |
283 | - (void)cancelFindString {
284 | [self.pspdfTextSearch cancelAllOperationsAndWait];
285 | self.pspdfTextSearch.delegate = nil;
286 | self.pspdfTextSearch = nil;
287 | }
288 |
289 | #pragma mark - Working with Selections
290 |
291 | - (nullable PDFXSelection *)selectionFromPage:(PDFXPage *)startPage atCharacterIndex:(NSUInteger)startCharacter toPage:(PDFXPage *)endPage atCharacterIndex:(NSUInteger)endCharacter {
292 | // TODO: implement.
293 | return nil;
294 | }
295 |
296 | - (nullable PDFXSelection *)selectionFromPage:(PDFXPage *)startPage atPoint:(PDFXPoint)startPoint toPage:(PDFXPage *)endPage atPoint:(PDFXPoint)endPoint {
297 | // TODO: implement.
298 | return nil;
299 | }
300 |
301 | // @property (nonatomic, readonly, nullable) PDFXSelection *selectionForEntireDocument;
302 |
303 | #pragma mark - Determining the Page Class
304 |
305 | - (Class)pageClass {
306 | return PDFXPage.class;
307 | }
308 |
309 | #pragma mark - Debugging
310 |
311 | - (NSString *)description {
312 | let components = @[super.description, @"->", self.pspdfDocument.description];
313 | return [components componentsJoinedByString:@" "];
314 | }
315 |
316 | #pragma mark - NSCopying
317 |
318 | - (nonnull id)copyWithZone:(nullable NSZone *)zone {
319 | return [[self.class alloc] initWithPSPDFDocument:self.pspdfDocument.copy];
320 | }
321 |
322 | #pragma mark - PSPDFTextSearchDelegate
323 |
324 | - (void)willStartSearch:(PSPDFTextSearch *)textSearch term:(NSString *)searchTerm isFullSearch:(BOOL)isFullSearch {
325 |
326 | }
327 |
328 | - (void)didUpdateSearch:(PSPDFTextSearch *)textSearch term:(NSString *)searchTerm newSearchResults:(NSArray *)searchResults pageIndex:(NSUInteger)pageIndex {
329 | for (PSPDFSearchResult *searchResult in searchResults) {
330 | let selection = [[PDFXSelection alloc] initWithDocument:self PSPDFSearchResult:searchResult];
331 | [self.delegate didMatchString:selection];
332 | }
333 | }
334 |
335 | - (void)didFailSearch:(PSPDFTextSearch *)textSearch withError:(NSError *)error {
336 | [self cancelFindString];
337 | }
338 |
339 | - (void)didFinishSearch:(PSPDFTextSearch *)textSearch term:(NSString *)searchTerm searchResults:(NSArray *)searchResults isFullSearch:(BOOL)isFullSearch pageTextFound:(BOOL)pageTextFound {
340 |
341 | }
342 |
343 | - (void)didCancelSearch:(PSPDFTextSearch *)textSearch term:(NSString *)searchTerm isFullSearch:(BOOL)isFullSearch {
344 | // Nothing to do.
345 | }
346 |
347 | #pragma mark - PSPDFKit
348 |
349 | - (instancetype)initWithPSPDFDocument:(PSPDFDocument *)pspdfDocument {
350 | if ((self = [super init])) {
351 | _pspdfDocument = pspdfDocument;
352 |
353 | // OPTIMIZE: this is a quick & dirty brute force implementation
354 | // allocating a `PDFXPage` instance for each page at creation time.
355 | // This can be made more efficient by only allocating & caching the
356 | // pages currently needed or in use.
357 | _pages = [self makeAllPagesForPSPDFDocument:pspdfDocument];
358 | }
359 | return self;
360 | }
361 |
362 | // @private instantiates a PDFXPage for each page of the document.
363 | - (NSArray *)makeAllPagesForPSPDFDocument:(PSPDFDocument *)pspdfDocument {
364 | let pageCount = pspdfDocument.pageCount;
365 | let pages = [NSMutableArray array];
366 |
367 | for (NSUInteger pageIndex = 0; pageIndex < pageCount; pageIndex += 1) {
368 | let page = [PDFXPage new];
369 | page.index = pageIndex;
370 | page.document = self;
371 | [pages addObject:page];
372 | }
373 |
374 | return pages;
375 | }
376 |
377 | #pragma mark - Swift
378 |
379 | - (NSInteger)__swiftPageCount {
380 | return PDFXSwiftIndexFromObjCIndex(self.pageCount);
381 | }
382 |
383 | - (nullable PDFXPage *)__swiftPageAtIndex:(NSInteger)index {
384 | let indexObjC = PDFXObjCIndexFromSwiftIndex(index);
385 | return [self pageAtIndex:indexObjC];
386 | }
387 |
388 | - (NSInteger)__swiftIndexForPage:(PDFXPage *)page {
389 | return PDFXSwiftIndexFromObjCIndex([self indexForPage:page]);
390 | }
391 |
392 | - (void)__swiftInsertPage:(PDFXPage *)page atIndex:(NSInteger)index {
393 | let indexObjC = PDFXObjCIndexFromSwiftIndex(index);
394 | [self insertPage:page atIndex:indexObjC];
395 | }
396 |
397 | - (void)__swiftRemovePageAtIndex:(NSInteger)index {
398 | let indexObjC = PDFXObjCIndexFromSwiftIndex(index);
399 | [self removePageAtIndex:indexObjC];
400 | }
401 |
402 | - (void)__swiftExchangePageAtIndex:(NSInteger)indexOfPageToReplace withPageAtIndex:(NSInteger)indexOfReplacementPage {
403 | let indexOfPageToReplaceObjC = PDFXObjCIndexFromSwiftIndex(indexOfPageToReplace);
404 | let indexOfReplacementPageObjC = PDFXObjCIndexFromSwiftIndex(indexOfReplacementPage);
405 | [self exchangePageAtIndex:indexOfPageToReplaceObjC withPageAtIndex:indexOfReplacementPageObjC];
406 | }
407 |
408 | - (nullable PDFXSelection *)__swiftSelectionFromPage:(PDFXPage *)startPage atCharacterIndex:(NSInteger)startCharacter toPage:(PDFXPage *)endPage atCharacterIndex:(NSUInteger)endCharacter {
409 | let startCharacterObjC = PDFXObjCIndexFromSwiftIndex(startCharacter);
410 | let endCharacterObjC = PDFXObjCIndexFromSwiftIndex(endCharacter);
411 | return [self selectionFromPage:startPage atCharacterIndex:startCharacterObjC toPage:endPage atCharacterIndex:endCharacterObjC];
412 | }
413 |
414 | @end
415 |
--------------------------------------------------------------------------------
/Tests/PDFXKitObjectiveCTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017-2020 PSPDFKit GmbH. All rights reserved.
3 | //
4 | // The PSPDFKit Sample applications are licensed with a modified BSD license.
5 | // Please see License for details. This notice may not be removed from
6 | // this file.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | static NSString *PDFXReplacePrefixPDFWithPDFX(NSString *string);
13 |
14 | @interface PDFXKitObjectiveCTests : XCTestCase
15 |
16 | @end
17 |
18 | @implementation PDFXKitObjectiveCTests
19 |
20 | - (void)setUp {
21 | [super setUp];
22 | // Nothing to do yet.
23 | }
24 |
25 | - (void)tearDown {
26 | // Nothing to do yet.
27 | [super tearDown];
28 | }
29 |
30 | #pragma mark - Printing String Definitions
31 |
32 | // This isn't a test but a simple script to PDFXKit definitions for PDFKit
33 | // strings. Simply remove `DISABLED` and copy the console output into the
34 | // appropriate implementation files.
35 |
36 | - (void)testPrintStringDefinitions {
37 | [self printAnnotationStringDefinitions];
38 | [self printBorderStringDefinitions];
39 | [self printDocumentStringDefinitions];
40 | [self printAppearanceCharacteristicsStringDefinitions];
41 | [self printThumbnailViewStringDefinitions];
42 | [self printPDFViewStringDefinitions];
43 | }
44 |
45 | - (void)printAnnotationStringDefinitions {
46 | NSLog(@"// ------------------------- -----------------------------");
47 | NSLog(@"");
48 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyAppearanceDictionary = @\"%@\";", PDFAnnotationKeyAppearanceDictionary);
49 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyAppearanceState = @\"%@\";", PDFAnnotationKeyAppearanceState);
50 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyBorder = @\"%@\";", PDFAnnotationKeyBorder);
51 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyColor = @\"%@\";", PDFAnnotationKeyColor);
52 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyContents = @\"%@\";", PDFAnnotationKeyContents);
53 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyDate = @\"%@\";", PDFAnnotationKeyDate);
54 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyFlags = @\"%@\";", PDFAnnotationKeyFlags);
55 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyName = @\"%@\";", PDFAnnotationKeyName);
56 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyPage = @\"%@\";", PDFAnnotationKeyPage);
57 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyRect = @\"%@\";", PDFAnnotationKeyRect);
58 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeySubtype = @\"%@\";", PDFAnnotationKeySubtype);
59 | NSLog(@"");
60 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyAction = @\"%@\";", PDFAnnotationKeyAction);
61 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyAdditionalActions = @\"%@\";", PDFAnnotationKeyAdditionalActions);
62 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyBorderStyle = @\"%@\";", PDFAnnotationKeyBorderStyle);
63 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyDefaultAppearance = @\"%@\";", PDFAnnotationKeyDefaultAppearance);
64 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyDestination = @\"%@\";", PDFAnnotationKeyDestination);
65 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyHighlightingMode = @\"%@\";", PDFAnnotationKeyHighlightingMode);
66 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyIconName = @\"%@\";", PDFAnnotationKeyIconName);
67 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyInklist = @\"%@\";", PDFAnnotationKeyInklist);
68 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyInteriorColor = @\"%@\";", PDFAnnotationKeyInteriorColor);
69 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyLineEndingStyles = @\"%@\";", PDFAnnotationKeyLineEndingStyles);
70 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyLinePoints = @\"%@\";", PDFAnnotationKeyLinePoints);
71 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyOpen = @\"%@\";", PDFAnnotationKeyOpen);
72 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyParent = @\"%@\";", PDFAnnotationKeyParent);
73 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyPopup = @\"%@\";", PDFAnnotationKeyPopup);
74 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyQuadding = @\"%@\";", PDFAnnotationKeyQuadding);
75 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyQuadPoints = @\"%@\";", PDFAnnotationKeyQuadPoints);
76 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyTextLabel = @\"%@\";", PDFAnnotationKeyTextLabel);
77 | NSLog(@"");
78 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetAppearanceDictionary = @\"%@\";", PDFAnnotationKeyWidgetAppearanceDictionary);
79 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetBackgroundColor = @\"%@\";", PDFAnnotationKeyWidgetBackgroundColor);
80 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetBorderColor = @\"%@\";", PDFAnnotationKeyWidgetBorderColor);
81 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetCaption = @\"%@\";", PDFAnnotationKeyWidgetCaption);
82 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetDefaultValue = @\"%@\";", PDFAnnotationKeyWidgetDefaultValue);
83 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetDownCaption = @\"%@\";", PDFAnnotationKeyWidgetDownCaption);
84 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldFlags = @\"%@\";", PDFAnnotationKeyWidgetFieldFlags);
85 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetFieldType = @\"%@\";", PDFAnnotationKeyWidgetFieldType);
86 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetMaxLen = @\"%@\";", PDFAnnotationKeyWidgetMaxLen);
87 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetOptions = @\"%@\";", PDFAnnotationKeyWidgetOptions);
88 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetRolloverCaption = @\"%@\";", PDFAnnotationKeyWidgetRolloverCaption);
89 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetRotation = @\"%@\";", PDFAnnotationKeyWidgetRotation);
90 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetTextLabelUI = @\"%@\";", PDFAnnotationKeyWidgetTextLabelUI);
91 | NSLog(@"PDFXAnnotationKey PDFXAnnotationKeyWidgetValue = @\"%@\";", PDFAnnotationKeyWidgetValue);
92 | NSLog(@"");
93 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeCircle = @\"%@\";", PDFAnnotationSubtypeCircle);
94 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeFreeText = @\"%@\";", PDFAnnotationSubtypeFreeText);
95 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeHighlight = @\"%@\";", PDFAnnotationSubtypeHighlight);
96 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeInk = @\"%@\";", PDFAnnotationSubtypeInk);
97 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeLine = @\"%@\";", PDFAnnotationSubtypeLine);
98 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeLink = @\"%@\";", PDFAnnotationSubtypeLink);
99 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypePopup = @\"%@\";", PDFAnnotationSubtypePopup);
100 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeSquare = @\"%@\";", PDFAnnotationSubtypeSquare);
101 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeStamp = @\"%@\";", PDFAnnotationSubtypeStamp);
102 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeStrikeOut = @\"%@\";", PDFAnnotationSubtypeStrikeOut);
103 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeText = @\"%@\";", PDFAnnotationSubtypeText);
104 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeUnderline = @\"%@\";", PDFAnnotationSubtypeUnderline);
105 | NSLog(@"PDFXAnnotationSubtype PDFXAnnotationSubtypeWidget = @\"%@\";", PDFAnnotationSubtypeWidget);
106 | NSLog(@"");
107 | NSLog(@"PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeButton = @\"%@\";", PDFAnnotationWidgetSubtypeButton);
108 | NSLog(@"PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeChoice = @\"%@\";", PDFAnnotationWidgetSubtypeChoice);
109 | NSLog(@"PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeSignature = @\"%@\";", PDFAnnotationWidgetSubtypeSignature);
110 | NSLog(@"PDFXAnnotationWidgetSubtype PDFXAnnotationWidgetSubtypeText = @\"%@\";", PDFAnnotationWidgetSubtypeText);
111 | NSLog(@"");
112 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleCircle = @\"%@\";", PDFAnnotationLineEndingStyleCircle);
113 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleClosedArrow = @\"%@\";", PDFAnnotationLineEndingStyleClosedArrow);
114 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleDiamond = @\"%@\";", PDFAnnotationLineEndingStyleDiamond);
115 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleNone = @\"%@\";", PDFAnnotationLineEndingStyleNone);
116 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleOpenArrow = @\"%@\";", PDFAnnotationLineEndingStyleOpenArrow);
117 | NSLog(@"PDFXAnnotationLineEndingStyle PDFXAnnotationLineEndingStyleSquare = @\"%@\";", PDFAnnotationLineEndingStyleSquare);
118 | NSLog(@"");
119 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeComment = @\"%@\";", PDFAnnotationTextIconTypeComment);
120 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeHelp = @\"%@\";", PDFAnnotationTextIconTypeHelp);
121 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeInsert = @\"%@\";", PDFAnnotationTextIconTypeInsert);
122 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeKey = @\"%@\";", PDFAnnotationTextIconTypeKey);
123 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNewParagraph = @\"%@\";", PDFAnnotationTextIconTypeNewParagraph);
124 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeNote = @\"%@\";", PDFAnnotationTextIconTypeNote);
125 | NSLog(@"PDFXAnnotationTextIconType PDFXAnnotationTextIconTypeParagraph = @\"%@\";", PDFAnnotationTextIconTypeParagraph);
126 | NSLog(@"");
127 | NSLog(@"PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeInvert = @\"%@\";", PDFAnnotationHighlightingModeInvert);
128 | NSLog(@"PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeNone = @\"%@\";", PDFAnnotationHighlightingModeNone);
129 | NSLog(@"PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModeOutline = @\"%@\";", PDFAnnotationHighlightingModeOutline);
130 | NSLog(@"PDFXAnnotationHighlightingMode PDFXAnnotationHighlightingModePush = @\"%@\";", PDFAnnotationHighlightingModePush);
131 | NSLog(@"// ------------------------- -----------------------------");
132 | }
133 |
134 | - (void)printBorderStringDefinitions {
135 | NSLog(@"// ------------------------- -----------------------------");
136 | NSLog(@"PDFXBorderKey PDFXBorderKeyDashPattern = @\"%@\";", PDFBorderKeyDashPattern);
137 | NSLog(@"PDFXBorderKey PDFXBorderKeyLineWidth = @\"%@\";", PDFBorderKeyLineWidth);
138 | NSLog(@"PDFXBorderKey PDFXBorderKeyStyle = @\"%@\";", PDFBorderKeyStyle);
139 | NSLog(@"// ------------------------- -----------------------------");
140 | }
141 |
142 | - (void)printDocumentStringDefinitions {
143 | NSLog(@"// ------------------------- -----------------------------");
144 | NSLog(@"NSNotificationName const PDFXDocumentDidUnlockNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidUnlockNotification));
145 | NSLog(@"NSNotificationName const PDFXDocumentDidBeginFindNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidBeginFindNotification));
146 | NSLog(@"NSNotificationName const PDFXDocumentDidEndFindNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidEndFindNotification));
147 | NSLog(@"NSNotificationName const PDFXDocumentDidBeginPageFindNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidBeginPageFindNotification));
148 | NSLog(@"NSNotificationName const PDFXDocumentDidEndPageFindNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidEndPageFindNotification));
149 | NSLog(@"NSNotificationName const PDFXDocumentDidFindMatchNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidFindMatchNotification));
150 | NSLog(@"NSNotificationName const PDFXDocumentDidBeginWriteNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidBeginWriteNotification));
151 | NSLog(@"NSNotificationName const PDFXDocumentDidEndWriteNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidEndWriteNotification));
152 | NSLog(@"NSNotificationName const PDFXDocumentDidBeginPageWriteNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidBeginPageWriteNotification));
153 | NSLog(@"NSNotificationName const PDFXDocumentDidEndPageWriteNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFDocumentDidEndPageWriteNotification));
154 | NSLog(@"");
155 | NSLog(@"PDFXDocumentAttribute PDFXDocumentAuthorAttribute = @\"%@\";", PDFDocumentAuthorAttribute);
156 | NSLog(@"PDFXDocumentAttribute PDFXDocumentCreationDateAttribute = @\"%@\";", PDFDocumentCreationDateAttribute);
157 | NSLog(@"PDFXDocumentAttribute PDFXDocumentCreatorAttribute = @\"%@\";", PDFDocumentCreatorAttribute);
158 | NSLog(@"PDFXDocumentAttribute PDFXDocumentKeywordsAttribute = @\"%@\";", PDFDocumentKeywordsAttribute);
159 | NSLog(@"PDFXDocumentAttribute PDFXDocumentModificationDateAttribute = @\"%@\";", PDFDocumentModificationDateAttribute);
160 | NSLog(@"PDFXDocumentAttribute PDFXDocumentProducerAttribute = @\"%@\";", PDFDocumentProducerAttribute);
161 | NSLog(@"PDFXDocumentAttribute PDFXDocumentSubjectAttribute = @\"%@\";", PDFDocumentSubjectAttribute);
162 | NSLog(@"PDFXDocumentAttribute PDFXDocumentTitleAttribute = @\"%@\";", PDFDocumentTitleAttribute);
163 | NSLog(@"");
164 | NSLog(@"PDFXDocumentWriteOption PDFXDocumentOwnerPasswordOption = @\"%@\";", PDFDocumentOwnerPasswordOption);
165 | NSLog(@"PDFXDocumentWriteOption PDFXDocumentUserPasswordOption = @\"%@\";", PDFDocumentUserPasswordOption);
166 | NSLog(@"// ------------------------- -----------------------------");
167 | }
168 |
169 | - (void)printAppearanceCharacteristicsStringDefinitions {
170 | NSLog(@"// ------------------------- -----------------------------");
171 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBackgroundColor = @\"%@\";", PDFAppearanceCharacteristicsKeyBackgroundColor);
172 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyBorderColor = @\"%@\";", PDFAppearanceCharacteristicsKeyBorderColor);
173 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyCaption = @\"%@\";", PDFAppearanceCharacteristicsKeyCaption);
174 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyDownCaption = @\"%@\";", PDFAppearanceCharacteristicsKeyDownCaption);
175 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRolloverCaption = @\"%@\";", PDFAppearanceCharacteristicsKeyRolloverCaption);
176 | NSLog(@"PDFXAppearanceCharacteristicsKey PDFXAppearanceCharacteristicsKeyRotation = @\"%@\";", PDFAppearanceCharacteristicsKeyRotation);
177 | NSLog(@"// ------------------------- -----------------------------");
178 | }
179 |
180 | - (void)printThumbnailViewStringDefinitions {
181 | NSLog(@"// ------------------------- -----------------------------");
182 | NSLog(@"NSNotificationName const PDFXThumbnailViewDocumentEditedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFThumbnailViewDocumentEditedNotification));
183 | NSLog(@"// ------------------------- -----------------------------");
184 | }
185 |
186 | - (void)printPDFViewStringDefinitions {
187 | NSLog(@"// ------------------------- -----------------------------");
188 | NSLog(@"NSNotificationName const PDFXViewDocumentChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewDocumentChangedNotification));
189 | NSLog(@"NSNotificationName const PDFXViewChangedHistoryNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewChangedHistoryNotification));
190 | NSLog(@"NSNotificationName const PDFXViewPageChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewPageChangedNotification));
191 | NSLog(@"NSNotificationName const PDFXViewScaleChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewScaleChangedNotification));
192 | NSLog(@"NSNotificationName const PDFXViewAnnotationHitNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewAnnotationHitNotification));
193 | NSLog(@"NSNotificationName const PDFXViewCopyPermissionNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewCopyPermissionNotification));
194 | NSLog(@"NSNotificationName const PDFXViewPrintPermissionNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewPrintPermissionNotification));
195 | NSLog(@"NSNotificationName const PDFXViewAnnotationWillHitNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewAnnotationWillHitNotification));
196 | NSLog(@"NSNotificationName const PDFXViewSelectionChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewSelectionChangedNotification));
197 | NSLog(@"NSNotificationName const PDFXViewDisplayModeChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewDisplayModeChangedNotification));
198 | NSLog(@"NSNotificationName const PDFXViewDisplayBoxChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewDisplayBoxChangedNotification));
199 | NSLog(@"NSNotificationName const PDFXViewVisiblePagesChangedNotification = @\"%@\";", PDFXReplacePrefixPDFWithPDFX(PDFViewVisiblePagesChangedNotification));
200 | NSLog(@"// ------------------------- -----------------------------");
201 | }
202 |
203 | @end
204 |
205 | static NSString *PDFXReplacePrefixPDFWithPDFX(NSString *string) {
206 | if ([string hasPrefix:@"PDF"]) {
207 | return [string stringByReplacingCharactersInRange:NSMakeRange(0, 3) withString:@"PDFX"];
208 | } else {
209 | return [@"PDFX" stringByAppendingString:string];
210 | }
211 | }
212 |
--------------------------------------------------------------------------------