Package apple.pdfkit

Class PDFDocument

    • Constructor Detail

      • PDFDocument

        protected PDFDocument​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static PDFDocument allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • allowsCommenting

        public boolean allowsCommenting()
        Create or modify annotations, including form field entries API-Since: 11.0
      • allowsContentAccessibility

        public boolean allowsContentAccessibility()
        Extract content, but only for the purpose of accessibility API-Since: 11.0
      • allowsCopying

        public boolean allowsCopying()
        Extract content (text, images, etc.) API-Since: 11.0
      • allowsDocumentAssembly

        public boolean allowsDocumentAssembly()
        Page management: insert, delete, and rotate pages API-Since: 11.0
      • allowsDocumentChanges

        public boolean allowsDocumentChanges()
        Modify the document contents except for page management (document attrubutes) API-Since: 11.0
      • allowsFormFieldEntry

        public boolean allowsFormFieldEntry()
        Modify form field entries, even if allowsCommenting is NO API-Since: 11.0
      • allowsPrinting

        public boolean allowsPrinting()
        Printing the document API-Since: 11.0
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • beginFindStringWithOptions

        public void beginFindStringWithOptions​(@NotNull
                                               @NotNull java.lang.String string,
                                               long options)
        Begins a find, searching the document for string. Search results are handled via a PDFDocumentDidFindMatchNotification or if the delegate implements -[didMatchString:]. Supported options are: NSCaseInsensitiveSearch, NSLiteralSearch, and NSBackwardsSearch.
      • beginFindStringsWithOptions

        public void beginFindStringsWithOptions​(@NotNull
                                                @NotNull NSArray<java.lang.String> strings,
                                                long options)
        Like -[beginFindString:withOptions:] above but it accepts an array of strings to search for. All other comments for -[beginFindString:withOptions:] above apply. API-Since: 11.0
      • cancelFindString

        public void cancelFindString()
        Method to cancel a search. Can be called from a user method being serviced by a find notification.
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • copyWithZone

        @NotNull
        public @NotNull java.lang.Object copyWithZone​(@Nullable
                                                      @Nullable org.moe.natj.general.ptr.VoidPtr zone)
        Specified by:
        copyWithZone in interface NSCopying
      • dataRepresentation

        @Nullable
        public @Nullable NSData dataRepresentation()
        Methods to record the current state of the PDFDocument as data or a file. Passing a QuartzFilter object in the options dictionary with the key @"QuartzFilter" will allow you to have the filter applied when saving the PDF. NOTE: Versions of PDFKit before SnowLeopard did not return autorelease data for -[dataRepresentation]. You had to release the data yourself. Beginning with apps compiled on SnowLeopard the data returned is autoreleased.
      • dataRepresentationWithOptions

        @Nullable
        public @Nullable NSData dataRepresentationWithOptions​(@NotNull
                                                              @NotNull NSDictionary<?,​?> options)
        API-Since: 11.0
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • delegate

        @Nullable
        public @Nullable PDFDocumentDelegate delegate()
        If a PDFDocument has a delegate, delegate methods may be called. See: NSNotificationNames and PDFDocumentDelegate below.
      • description_static

        public static java.lang.String description_static()
      • documentAttributes

        @Nullable
        public @Nullable NSDictionary<?,​?> documentAttributes()
        Returns a dictionary with PDF metadata. Metadata is optional for PDF's and so some of the keys may be missing or the entire dictionary may be empty. See attributes above for keys.
      • documentRef

        @Nullable
        public @Nullable CGPDFDocumentRef documentRef()
        This is the CGPDFDocument associated with the PDFDocument object. With this object you can call many CoreGraphics API. May return NULL if the document was not created from an existing PDF file or data.
      • documentURL

        @Nullable
        public @Nullable NSURL documentURL()
        May return NULL if the document was created from NSData.
      • exchangePageAtIndexWithPageAtIndex

        public void exchangePageAtIndexWithPageAtIndex​(long indexA,
                                                       long indexB)
      • findStringFromSelectionWithOptions

        @Nullable
        public @Nullable PDFSelection findStringFromSelectionWithOptions​(@NotNull
                                                                         @NotNull java.lang.String string,
                                                                         @Nullable
                                                                         @Nullable PDFSelection selection,
                                                                         long options)
        Searches for only the next instance of string beginning after the last character of selection with options (or preceding the first character of the selection if NSBackwardsSearch is specified as a search option). Returns next instance as a PDFSelection or NULL if the end of the document is reached. Supported options are: NSCaseInsensitiveSearch, NSLiteralSearch, and NSBackwardsSearch. Passing in NULL for selection will start the search from the beginning of the document (or end if NSBackwardsSearch is specified).
      • findStringWithOptions

        @NotNull
        public @NotNull NSArray<? extends PDFSelection> findStringWithOptions​(@NotNull
                                                                              @NotNull java.lang.String string,
                                                                              long options)
        Searches entire document for string and returns an array of PDFSelections representing all instances found. May return an empty array (if not found). Supported options are: NSCaseInsensitiveSearch, NSLiteralSearch, and NSBackwardsSearch.
      • hash_static

        public static long hash_static()
      • indexForPage

        public long indexForPage​(@NotNull
                                 @NotNull PDFPage page)
        Given a PDFPage, returns the pages index within the document. Indices are zero-based.
      • insertPageAtIndex

        public void insertPageAtIndex​(@NotNull
                                      @NotNull PDFPage page,
                                      long index)
        Methods allowing pages to be inserted, removed, and re-ordered. Can throw range exceptions. Note: when inserting a PDFPage, you have to be careful if that page came from another PDFDocument. PDFPage's have a notion of a single document that owns them and when you call the methods below the PDFPage passed in is assigned a new owning document. You'll want to call -[PDFPage copy] first then and pass this copy to the blow methods. This allows the orignal PDFPage to maintain its original document.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isEncrypted

        public boolean isEncrypted()
        Whether the PDF is encrypted. With the right password, a PDF can be unlocked - nonetheless, the PDF still indicates that it is encrypted - just no longer locked. Some PDF's may be encrypted but can be unlocked with the empty string. These are unlocked automatically.
      • isFinding

        public boolean isFinding()
        Returns YES if document is currently searching for a string.
      • isLocked

        public boolean isLocked()
        See comments above.
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • majorVersion

        public long majorVersion()
        PDF version of the PDF file (example: major version = 1, minor = 4; PDF v1.4).
      • minorVersion

        public long minorVersion()
      • outlineItemForSelection

        @Nullable
        public @Nullable PDFOutline outlineItemForSelection​(@NotNull
                                                            @NotNull PDFSelection selection)
        Given a PDFSelection, this method returns the child outline item the selection most closely falls beneath. Since a selection may span multiple outline items, only the point representing the first character of the PDFSelection is considered. Typically, outlines indicate things like chapters for the PDF. Therefore, this method would help you identify the chapter the selection falls within.
      • outlineRoot

        @Nullable
        public @Nullable PDFOutline outlineRoot()
        Allows you specify a PDFOutline as the root outline item for this document. When the PDF is saved the outline tree structure is written out to the destination PDF file. Passing NULL is a way to strip any outline from a document. Returns the root outline object for the PDF (or NULL if none). API-Since: 11.0
      • pageAtIndex

        @Nullable
        public @Nullable PDFPage pageAtIndex​(long index)
        Returns a PDFPage object representing the page at index. Will raise an exception if index is out of bounds. Indices are zero-based.
      • pageClass

        @NotNull
        public @NotNull org.moe.natj.objc.Class pageClass()
        This is the class that will be allocated and initialized when page objects are created for the document. The default implementation returns [PDFPage class] but if you want PDFDocument to use your own custom class you can subclass PDFDocument and implement this method to return your own custom class. Your class should be a subclass of PDFPage (otherwise the behavior is undefined).
      • pageCount

        public long pageCount()
        The number of pages in the document.
      • permissionsStatus

        public long permissionsStatus()
        Returns the permissions status of the PDF document. You have kPDFDocumentPermissionsNone status for an encrypted document that you have not supplied either a valid user or owner password. For a document with no encryption, you automatically have kPDFDocumentPermissionsOwner status. API-Since: 11.0
      • removePageAtIndex

        public void removePageAtIndex​(long index)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • selectionForEntireDocument

        @Nullable
        public @Nullable PDFSelection selectionForEntireDocument()
        Returns a selection representing text for the entire document.
      • selectionFromPageAtCharacterIndexToPageAtCharacterIndex

        @Nullable
        public @Nullable PDFSelection selectionFromPageAtCharacterIndexToPageAtCharacterIndex​(@NotNull
                                                                                              @NotNull PDFPage startPage,
                                                                                              long startCharacter,
                                                                                              @NotNull
                                                                                              @NotNull PDFPage endPage,
                                                                                              long endCharacter)
        Similar to the above method but allows you to specify a character index for the start and end pages.
      • selectionFromPageAtPointToPageAtPoint

        @Nullable
        public @Nullable PDFSelection selectionFromPageAtPointToPageAtPoint​(@NotNull
                                                                            @NotNull PDFPage startPage,
                                                                            CGPoint startPoint,
                                                                            @NotNull
                                                                            @NotNull PDFPage endPage,
                                                                            CGPoint endPoint)
        Returns a selection representing text from page startPage and point startPt to page endPage and to point endPt on that page. Points are in page-space and relative to their respective pages. Start and end page can be the same (and are then equivalent to calling -[PDFPage selectionFromPoint: toPoint:]).
      • setDelegate_unsafe

        public void setDelegate_unsafe​(@Nullable
                                       @Nullable PDFDocumentDelegate value)
        If a PDFDocument has a delegate, delegate methods may be called. See: NSNotificationNames and PDFDocumentDelegate below.
      • setDelegate

        public void setDelegate​(@Nullable
                                @Nullable PDFDocumentDelegate value)
        If a PDFDocument has a delegate, delegate methods may be called. See: NSNotificationNames and PDFDocumentDelegate below.
      • setDocumentAttributes

        public void setDocumentAttributes​(@Nullable
                                          @Nullable NSDictionary<?,​?> value)
        Returns a dictionary with PDF metadata. Metadata is optional for PDF's and so some of the keys may be missing or the entire dictionary may be empty. See attributes above for keys.
      • setOutlineRoot

        public void setOutlineRoot​(@Nullable
                                   @Nullable PDFOutline value)
        Allows you specify a PDFOutline as the root outline item for this document. When the PDF is saved the outline tree structure is written out to the destination PDF file. Passing NULL is a way to strip any outline from a document. Returns the root outline object for the PDF (or NULL if none). API-Since: 11.0
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • string

        @Nullable
        public @Nullable java.lang.String string()
        Convenience method. Returns a string representing the entire document (each page's string concatenated with line feeds between pages).
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • unlockWithPassword

        public boolean unlockWithPassword​(@NotNull
                                          @NotNull java.lang.String password)
        Means of passing in a password to unlock encrypted PDF's. Calling -[unlockWithPassword:] will attempt to unlock the PDF. If successful, a PDFDocumentDidUnlockNotification notification is sent. You cannot "re-lock" a PDF by passing in a bogus password. Returns YES if the document is now unlocked, NO otherwise ([self isLocked] == NO).
      • version_static

        public static long version_static()
      • writeToFile

        public boolean writeToFile​(@NotNull
                                   @NotNull java.lang.String path)
        -[writeToFile:withOptions:] and -[writeToURL:withOptions:] methods may take any CoreGraphics options that are typically passed into CGPDFContextCreate(...) and CGPDFContextCreateWithURL(...)'s auxiliaryInfo dictionary. For encryption, you may provide an owner and user password via the keys PDFDocumentWriteOption, where the values should be non-zero length strings.
      • writeToFileWithOptions

        public boolean writeToFileWithOptions​(@NotNull
                                              @NotNull java.lang.String path,
                                              @Nullable
                                              @Nullable NSDictionary<java.lang.String,​?> options)
      • writeToURL

        public boolean writeToURL​(@NotNull
                                  @NotNull NSURL url)
      • writeToURLWithOptions

        public boolean writeToURLWithOptions​(@NotNull
                                             @NotNull NSURL url,
                                             @Nullable
                                             @Nullable NSDictionary<java.lang.String,​?> options)
      • accessPermissions

        public long accessPermissions()
        Returns all 7 properties above as a PDFAccessPermissions value.
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.