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 java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • allowsCommenting

        public boolean allowsCommenting()
        Create or modify annotations, including form field entries
      • allowsContentAccessibility

        public boolean allowsContentAccessibility()
        Extract content, but only for the purpose of accessibility
      • allowsCopying

        public boolean allowsCopying()
        Extract content (text, images, etc.)
      • allowsDocumentAssembly

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

        public boolean allowsDocumentChanges()
        Modify the document contents except for page management (document attrubutes)
      • allowsFormFieldEntry

        public boolean allowsFormFieldEntry()
        Modify form field entries, even if allowsCommenting is NO
      • allowsPrinting

        public boolean allowsPrinting()
        Printing the document
      • automaticallyNotifiesObserversForKey

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

        public void beginFindStringWithOptions​(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​(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.
      • 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​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

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

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

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

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

        public 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

        public NSData dataRepresentationWithOptions​(NSDictionary<?,​?> options)
      • debugDescription_static

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

        public 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

        public 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

        public 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

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

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

        public PDFSelection findStringFromSelectionWithOptions​(java.lang.String string,
                                                               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

        public NSArray<? extends PDFSelection> findStringWithOptions​(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​(PDFPage page)
        Given a PDFPage, returns the pages index within the document. Indices are zero-based.
      • insertPageAtIndex

        public void insertPageAtIndex​(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

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(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()
      • new_objc

        public static java.lang.Object new_objc()
      • outlineItemForSelection

        public PDFOutline outlineItemForSelection​(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

        public 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).
      • pageAtIndex

        public 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

        public 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.
      • 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

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

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

        public PDFSelection selectionFromPageAtPointToPageAtPoint​(PDFPage startPage,
                                                                  CGPoint startPoint,
                                                                  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​(PDFDocumentDelegate value)
        If a PDFDocument has a delegate, delegate methods may be called. See: NSNotificationNames and PDFDocumentDelegate below.
      • setDelegate

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

        public void setDocumentAttributes​(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​(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).
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • string

        public 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​(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​(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​(java.lang.String path,
                                              NSDictionary<java.lang.String,​?> options)
      • writeToURL

        public boolean writeToURL​(NSURL url)
      • writeToURLWithOptions

        public boolean writeToURLWithOptions​(NSURL url,
                                             NSDictionary<java.lang.String,​?> options)