PTPDFDocumentManager
@interface PTPDFDocumentManager : NSObject <PTOverridable>
Instances of the PTPDFDocumentManager
class control how documents are accessed, usually by a
viewer component.
-
Initializes a new
PTPDFDocumentManager
instance.Declaration
Objective-C
- (nonnull instancetype)init;
Swift
init()
Return Value
an initialized
PTPDFDocumentManager
instance -
The delegate object of the
PTPDFDocumentManager
.Note
The default value of this property isnil
.Declaration
Objective-C
@property (nonatomic, weak, nullable) id<PTPDFDocumentManagerDelegate> delegate;
Swift
weak var delegate: (any PTPDFDocumentManagerDelegate)? { get set }
-
The documents being managed by this
PTPDFDocumentManager
.Note
The default value of this property isnil
.Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSArray<PTPDFDocumentFile *> *documents;
Swift
var documents: [PTPDFDocumentFile]? { get }
-
Creates and returns a new
PTPDFDocumentFile
instance for the file at the given URL.Note
The document is not added to the list of documents in
PTPDFDocumentManager.documents
.Declaration
Objective-C
- (nonnull PTPDFDocumentFile *)makeDocumentForURL:(nonnull NSURL *)url;
Swift
func makeDocument(for url: URL) -> PTPDFDocumentFile
Parameters
url
The URL of the file for which a document is to be created.
Return Value
A new
PTPDFDocumentFile
instance for the file. -
Returns the document whose file is located by the specified URL.
Declaration
Objective-C
- (nullable PTPDFDocumentFile *)documentForURL:(nonnull NSURL *)url;
Swift
func document(for url: URL) -> PTPDFDocumentFile?
Parameters
url
The URL of the document to retrieve.
Return Value
The document for the specified URL, or
nil
if there is no such document. -
Adds the given document to the list of managed documents.
Declaration
Objective-C
- (void)addDocument:(nonnull PTPDFDocumentFile *)document;
Swift
func addDocument(_ document: PTPDFDocumentFile)
Parameters
document
The document to add.
-
Removes the given document from the list of managed documents.
Declaration
Objective-C
- (void)removeDocument:(nonnull PTPDFDocumentFile *)document;
Swift
func removeDocument(_ document: PTPDFDocumentFile)
Parameters
document
The document to remove.
-
The URL of the directory where documents are cached.
The document cache is used for remote (HTTP) file downloads, documents converted from other formats, and any other document-related operation that needs a safe location on-disk.
The default value of this property is the return value of the class method
+[PTPDFDocumentManager defaultDocumentCacheDirectoryURLWithError:]
.Declaration
Objective-C
@property (nonatomic, strong) NSURL *_Nonnull documentCacheDirectoryURL;
Swift
var documentCacheDirectoryURL: URL { get set }
-
Returns the URL of the default directory used for caching documents.
Note
In Swift, this method returns
Void
and is marked with thethrows
keyword to indicate that it throws an error in cases of failure.Declaration
Objective-C
+ (nullable NSURL *)defaultDocumentCacheDirectoryURLWithError: (out NSError *_Nullable *_Nullable)outError;
Swift
class func defaultDocumentCacheDirectoryURL() throws -> URL
Parameters
outError
On input, a pointer to an error object. If an error occurs , this pointer is set to an actual error object containing the error information. You may specify
nil
for this parameter if you do not want the error information.Return Value
the default document cache directory URL, or
nil
if an error occurred