PTFileAttachmentHandler
@interface PTFileAttachmentHandler : NSObject
The PTFileAttachmentHandler class handles file attachment annotations. It can be used to export
file attachment annotations from a document.
-
Initializes a newly created
PTFileAttachmentHandlerinstance.Declaration
Objective-C
- (nonnull instancetype)init;Swift
init()Return Value
an initialized
PTFileAttachmentHandlerinstance -
Exports the specified file attachment annotation from the given PDF document.
Declaration
Objective-C
- (void)exportFileAttachment:(nonnull PTFileAttachment *)fileAttachment fromPDFDoc:(nonnull PTPDFDoc *)doc;Swift
func export(_ fileAttachment: PTFileAttachment, from doc: PTPDFDoc)Parameters
fileAttachmentthe file attachment to be exported
docthe PDF document containing the file attachment
-
Exports the file attachment annotation from the PDF document.
Declaration
Objective-C
- (void)exportFileAttachment:(nonnull PTFileAttachment *)fileAttachment fromPDFDoc:(nonnull PTPDFDoc *)pdfDoc completion:(nonnull void (^)(NSURL *_Nullable, NSError *_Nullable))completion;Swift
func export(_ fileAttachment: PTFileAttachment, from pdfDoc: PTPDFDoc) async throws -> URLParameters
fileAttachmentThe file attachment annotation to be exported
pdfDocThe PDF document containing the file attachment
completionA block to be called when the file attachment has been exported. The URL of the exported file is provided when the operation is successful, otherwise an error is provided that details why the file attachment could not be exported. The block is called asynchronously on the main queue.
-
The delegate of the file attachment handler. The delegate must adopt the
PTFileAttachmentHandlerDelegateprotocol.Declaration
Objective-C
@property (nonatomic, weak, nullable) id<PTFileAttachmentHandlerDelegate> delegate;Swift
weak var delegate: (any PTFileAttachmentHandlerDelegate)? { get set }
-
Returns the filename for the specified file attachment annotation in the given PDF document.
Declaration
Objective-C
+ (nullable NSString *) filenameForFileAttachment:(nonnull PTFileAttachment *)fileAttachment inDocument:(nonnull PTPDFDoc *)pdfDoc withError:(NSError *_Nullable *_Nullable)error;Swift
class func filename(for fileAttachment: PTFileAttachment, inDocument pdfDoc: PTPDFDoc) throws -> StringParameters
fileAttachmentThe file attachment for which to get the filename
pdfDocThe PDF document containing the file attachment annotation
errorOn 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
nilfor this parameter if you do not want the error information.Return Value
the filename for the file attachment annotation, or
nilif an error occurred
PTFileAttachmentHandler Class Reference