Package apple.pdfkit
Class PDFDocument
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.pdfkit.PDFDocument
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPDFDocument(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static PDFDocumentalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)booleanallowsCommenting()Create or modify annotations, including form field entriesbooleanallowsContentAccessibility()Extract content, but only for the purpose of accessibilitybooleanallowsCopying()Extract content (text, images, etc.)booleanallowsDocumentAssembly()Page management: insert, delete, and rotate pagesbooleanallowsDocumentChanges()Modify the document contents except for page management (document attrubutes)booleanallowsFormFieldEntry()Modify form field entries, even if allowsCommenting is NObooleanallowsPrinting()Printing the documentstatic booleanautomaticallyNotifiesObserversForKey(java.lang.String key)voidbeginFindStringsWithOptions(NSArray<java.lang.String> strings, long options)Like -[beginFindString:withOptions:] above but it accepts an array of strings to search for.voidbeginFindStringWithOptions(java.lang.String string, long options)Begins a find, searching the document for string.voidcancelFindString()Method to cancel a search.static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()java.lang.ObjectcopyWithZone(org.moe.natj.general.ptr.VoidPtr zone)NSDatadataRepresentation()Methods to record the current state of the PDFDocument as data or a file.NSDatadataRepresentationWithOptions(NSDictionary<?,?> options)static java.lang.StringdebugDescription_static()PDFDocumentDelegatedelegate()If a PDFDocument has a delegate, delegate methods may be called.static java.lang.Stringdescription_static()NSDictionary<?,?>documentAttributes()Returns a dictionary with PDF metadata.CGPDFDocumentRefdocumentRef()This is the CGPDFDocument associated with the PDFDocument object.NSURLdocumentURL()May return NULL if the document was created from NSData.voidexchangePageAtIndexWithPageAtIndex(long indexA, long indexB)PDFSelectionfindStringFromSelectionWithOptions(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).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.static longhash_static()longindexForPage(PDFPage page)Given a PDFPage, returns the pages index within the document.PDFDocumentinit()Initializers.PDFDocumentinitWithData(NSData data)PDFDocumentinitWithURL(NSURL url)voidinsertPageAtIndex(PDFPage page, long index)Methods allowing pages to be inserted, removed, and re-ordered.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)booleanisEncrypted()Whether the PDF is encrypted.booleanisFinding()Returns YES if document is currently searching for a string.booleanisLocked()See comments above.static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)longmajorVersion()PDF version of the PDF file (example: major version = 1, minor = 4; PDF v1.4).longminorVersion()static java.lang.Objectnew_objc()PDFOutlineoutlineItemForSelection(PDFSelection selection)Given a PDFSelection, this method returns the child outline item the selection most closely falls beneath.PDFOutlineoutlineRoot()Allows you specify a PDFOutline as the root outline item for this document.PDFPagepageAtIndex(long index)Returns a PDFPage object representing the page at index.org.moe.natj.objc.ClasspageClass()This is the class that will be allocated and initialized when page objects are created for the document.longpageCount()The number of pages in the document.longpermissionsStatus()Returns the permissions status of the PDF document.voidremovePageAtIndex(long index)static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)PDFSelectionselectionForEntireDocument()Returns a selection representing text for the entire document.PDFSelectionselectionFromPageAtCharacterIndexToPageAtCharacterIndex(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.PDFSelectionselectionFromPageAtPointToPageAtPoint(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.voidsetDelegate(PDFDocumentDelegate value)If a PDFDocument has a delegate, delegate methods may be called.voidsetDelegate_unsafe(PDFDocumentDelegate value)If a PDFDocument has a delegate, delegate methods may be called.voidsetDocumentAttributes(NSDictionary<?,?> value)Returns a dictionary with PDF metadata.voidsetOutlineRoot(PDFOutline value)Allows you specify a PDFOutline as the root outline item for this document.static voidsetVersion_static(long aVersion)java.lang.Stringstring()Convenience method.static org.moe.natj.objc.Classsuperclass_static()booleanunlockWithPassword(java.lang.String password)Means of passing in a password to unlock encrypted PDF's.static longversion_static()booleanwriteToFile(java.lang.String path)-[writeToFile:withOptions:] and -[writeToURL:withOptions:] methods may take any CoreGraphics options that are typically passed into CGPDFContextCreate(...) and CGPDFContextCreateWithURL(...)'booleanwriteToFileWithOptions(java.lang.String path, NSDictionary<java.lang.String,?> options)booleanwriteToURL(NSURL url)booleanwriteToURLWithOptions(NSURL url, NSDictionary<java.lang.String,?> options)-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static PDFDocument alloc()
-
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:
copyWithZonein interfaceNSCopying
-
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.
-
init
public PDFDocument init()
Initializers.
-
initWithData
public PDFDocument initWithData(NSData data)
-
initWithURL
public PDFDocument initWithURL(NSURL url)
-
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.
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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)
-
-