PSPDFProcessorConfiguration


@interface PSPDFProcessorConfiguration : NSObject <NSCopying>

Container for various settings for manipulating documents with PSPDFProcessor. - note: Some basic options are available without the Document Processor component, however most options do require this component to be licensed. Learn more at https://pspdfkit.com/features/document-editor/ios

  • Designated initializer

    Declaration

    Objective-C

    - (nullable instancetype)initWithDocument:(nullable PSPDFDocument *)document;

    Swift

    init?(document: PSPDFDocument?)

    Parameters

    document

    The document that the configuration is based on. If a document is given, it needs to be valid, else we return nil.

    Return Value

    The processor configuration or nil in case the document cannot be processed or is not valid.

  • The source document.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) PSPDFDocument *document;

    Swift

    var document: PSPDFDocument? { get }
  • Returns the page count of the currently configured generated document.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSInteger pageCount;

    Swift

    var pageCount: Int { get }
  • Instructs the processor to change form field names as described in the mapping. The partial field name (see PDF Reference 1.7, 12.7.3.2, “Field Names”).

    Note

    This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSDictionary<NSString *, NSString *> *_Nonnull formFieldNameMappings;

    Swift

    var formFieldNameMappings: [String : String] { get set }
  • Instructs the processor to change form mapping names as described in the mapping. The mapping name that shall be used when exporting interactive form field data from the document.

    Note

    This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSDictionary<NSString *, NSString *> *_Nonnull formMappingNameMappings;

    Swift

    var formMappingNameMappings: [String : String] { get set }
  • Moves pages from the specified indexes to the destination index. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)movePages:(nonnull NSIndexSet *)indexes
        toDestinationIndex:(NSUInteger)destinationPageIndex;

    Swift

    func movePages(_ indexes: IndexSet, toDestinationIndex destinationPageIndex: UInt)
  • Removes pages from the document. This will also update pageCount.

    Declaration

    Objective-C

    - (void)removePages:(nonnull NSIndexSet *)indexes;

    Swift

    func removePages(_ indexes: IndexSet)
  • If this is set to @YES, all blank pages will be removed from the generated document. This does NOT update pageCount as it only goes into effect while processing the document.

    Declaration

    Objective-C

    - (void)setShouldStripBlankPagesOnGenerate:(BOOL)shouldStrip;

    Swift

    func setShouldStripBlankPagesOnGenerate(_ shouldStrip: Bool)
  • Removes all pages that are not listed in indexes.

    Declaration

    Objective-C

    - (void)includeOnlyIndexes:(nonnull NSIndexSet *)indexes;

    Swift

    func includeOnlyIndexes(_ indexes: IndexSet)
  • Rotates a page. degrees must be a value of 0, 90, 180 or 270. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)rotatePage:(NSUInteger)pageIndex by:(NSUInteger)degrees;

    Swift

    func rotatePage(_ pageIndex: UInt, by degrees: UInt)
  • Scales the given page index to the given size. The size must be specified in PDF points. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)scalePage:(NSUInteger)pageIndex toSize:(CGSize)size;

    Swift

    func scalePage(_ pageIndex: UInt, to size: CGSize)
  • Scales the given page index to the given size. The size must be specified in millimeters. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)scalePage:(NSUInteger)pageIndex toSizeInMillimeter:(CGSize)mmSize;

    Swift

    func scalePage(_ pageIndex: UInt, toSizeInMillimeter mmSize: CGSize)
  • Changes the CropBox for the given page to the given rect. The rect must be specified in points. This does NOT scale the page. See scalePage:toSizeInMillimeter: and scalePage:toSize:. Definition of a CropBox from the PDF spec: The crop box defines the region to which the contents of the page shall be clipped (cropped) when displayed or printed. Unlike the other boxes, the crop box has no defined meaning in terms of physical page geometry or intended use; it merely imposes clipping on the page contents. However, in the absence of additional information (such as imposition instructions specified in a JDF or PJTF job ticket), the crop box determines how the page’s contents shall be positioned on the output medium. The default value is the page’s media box. TL;DR: The visible part of the page. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)changeCropBoxForPageAtIndex:(NSUInteger)pageIndex toRect:(CGRect)rect;

    Swift

    func changeCropBoxForPage(at pageIndex: UInt, to rect: CGRect)
  • Changes the MediaBox for the given page to the given rect. The rect must be specified in points. This does NOT scale the page. See scalePage:toSizeInMillimeter: and scalePage:toSize:. Definition of a MediaBox from the PDF spec: The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. It may also include areas close to the edges of the medium that cannot be marked because of physical limitations of the output device. Content falling outside this boundary may safely be discarded without affecting the meaning of the PDF file. TL;DR: The size of the page. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)changeMediaBoxForPageAtIndex:(NSUInteger)pageIndex toRect:(CGRect)rect;

    Swift

    func changeMediaBoxForPage(at pageIndex: UInt, to rect: CGRect)
  • Adds a new page at destinationPageIndex. If newPageConfiguation is nil, the size of the new page will match the page size of the first page. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)addNewPageAtIndex:(NSUInteger)destinationPageIndex
                configuration:
                    (nullable PSPDFNewPageConfiguration *)newPageConfiguation;

    Swift

    func addNewPage(at destinationPageIndex: UInt, configuration newPageConfiguation: PSPDFNewPageConfiguration?)
  • This method allows you to change how a certain type of annotation is included in the resulting document. If all annotations should be changed, use PSPDFAnnotationTypeAll as the annotationTypes. If finer control is needed, look at modifyAnnotations:change:error:.

    Declaration

    Objective-C

    - (void)modifyAnnotationsOfTypes:(PSPDFAnnotationType)annotationTypes
                              change:(PSPDFAnnotationChange)annotationChange;

    Swift

    func modifyAnnotations(ofTypes annotationTypes: PSPDFAnnotationType, change annotationChange: PSPDFAnnotationChange)
  • This method allows you to change the way certain annotations are included in the resulting document. The annotations selected here take priority over the changes specified using modifyAnnotationsOfType:change: or modifyFormsOfType:change:. - note: This method might take a long time if you specify a lot of annotations. Use carefully.

    Declaration

    Objective-C

    - (BOOL)modifyAnnotations:(nonnull NSArray<PSPDFAnnotation *> *)annotations
                       change:(PSPDFAnnotationChange)annotationChange
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func modifyAnnotations(_ annotations: [PSPDFAnnotation], change annotationChange: PSPDFAnnotationChange) throws
  • This method allows you to change the way certain form types are included in the resulting document. For example, you can choose to only remove signature form elements. - note: This method requires the AcroForm component to be enabled for your license.

    Declaration

    Objective-C

    - (void)modifyFormsOfType:(PSPDFFormFieldType)formFieldType
                       change:(PSPDFAnnotationChange)annotationChange;

    Swift

    func modifyForms(of formFieldType: PSPDFFormFieldType, change annotationChange: PSPDFAnnotationChange)
  • Merges the item onto the page with index destinationPageIndex. A item can be a image or another PDF page, see PSPDFProcessorItem. - note: This method requires the Document Editor component to be enabled for your license.

    Declaration

    Objective-C

    - (void)mergeItem:(nonnull PSPDFProcessorItem *)item
               onPage:(NSUInteger)destinationPageIndex;

    Swift

    func merge(_ item: PSPDFProcessorItem, onPage destinationPageIndex: UInt)
  • Allows a drawing block of type PSPDFRenderDrawBlock being called for each page. This will set up a similar drawing block as you’d get with calling UIGraphicsBeginImageContext. The drawing will get flattened on each page currently configured to be exported.

    Declaration

    Objective-C

    - (void)drawOnAllCurrentPages:(nonnull PSPDFRenderDrawBlock)drawBlock;

    Swift

    func draw(onAllCurrentPages drawBlock: @escaping PSPDFRenderDrawBlock)
  • Returns the metadata that will be written into the new document. By default, this is set to the metadata of the original document. - note: On writing metadata to the new document, PSPDFMetadataModDateKey will be set to the current date and time and PSPDFMetadataProducerKey will be set to PSPDFKit. You can overwrite these values by setting them with updateMetadata.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSDictionary<NSString *, NSString *> *_Nonnull metadata;

    Swift

    var metadata: [String : String] { get }
  • Updates the metadata that will be saved in the generated PDF. Any value you pass along here will either be replaced or inserted into the current metadata configuration. See PSPDFMetadataTitleKey for examples of what keys to use. - note: This does not remove any metadata entries. See clearMetadata.

    Declaration

    Objective-C

    - (void)updateMetadata:(nonnull NSDictionary<NSString *, NSString *> *)metadata;

    Swift

    func updateMetadata(_ metadata: [String : String])
  • Clears any previous metadata. - note: PSPDFMetadataModDateKey and PSPDFMetadataProducerKey will still be set in the resulting PDF. See metadata.

    Declaration

    Objective-C

    - (void)clearMetadata;

    Swift

    func clearMetadata()