Class: UIPrintFormatter

Inherits:
NSObject show all

Overview

UIPrintFormatter is an abstract base class for print formatters: objects that lay out custom printable content that can cross page boundaries. Given a print formatter, the printing system can automate the printing of the type of content associated with the print formatter.

Direct Known Subclasses

UIMarkupTextPrintFormatter, UISimpleTextPrintFormatter, UIViewPrintFormatter

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (UIEdgeInsets) contentInsets

The distances the edges of content are inset from the printing rectangle. This property adjusts the margins for content printed by the formatter. The printing rectangle defines the area the printer is capable of printing in; each inset is an inward distance, in points, from a side of the printing area. The top inset is used only on the first page that the formatter draws. The bottom inset is not used. You can use the UIEdgeInsetsMake macro to create a UIEdgeInsets structure.

Returns:

- (Float) maximumContentHeight

The maximum height of the content area. UIPrintFormatter uses this value to determine where the content rectangle begins on the first page. It compares the value of this property with the printing rectangle’s height minus the header and footer heights and the top inset value (of contentInsets); it uses the lower of the two values. The default value of this property is the maximum float value.

Returns:

- (Float) maximumContentWidth

The maximum width of the content area. UIPrintFormatter uses this value to determine the maximum width of the content rectangle. It compares the value of this property with the printing rectangle’s width minus the left and right inset values and uses the lower of the two. The default value of this property is the maximum float value.

Returns:

- (Integer) pageCount (readonly)

The number of pages to be printed. (read-only) UIPrintFormatter calculates this value based on the layout metrics and content.

Returns:

- (UIPrintPageRenderer) printPageRenderer (readonly)

Returns the page renderer with which the receiver is associated. If the receiving print formatter was not added to a page renderer—that is, it was assigned to the printFormatter property of the UIPrintInteractionController class—the value returned is nil.

Returns:

  • (UIPrintPageRenderer)

- (Integer) startPage

The index of the first page that the print formatter lays out. The value is a zero-based index. You can set the starting page of a print formatter by assigning an index to this property or by passing one as the second argument of the addPrintFormatter:startingAtPageAtIndex: method of UIPrintPageRenderer.

Returns:

Instance Method Details

- (Object) drawInRect(rect, forPageAtIndex:pageIndex)

Draws the portion of a print formatter’s content that goes in the given area for the specified page This method is called by the default implementation of drawPrintFormatter:forPageAtIndex: of the UIPrintPageRenderer class for each print formatter associated with a page.

Parameters:

  • rect (CGRect)

    The area in which to draw the content.

  • pageIndex (Integer)

    The number of the page of content to draw.

Returns:

- (CGRect) rectForPageAtIndex(pageIndex)

Returns the area enclosing a specified page of content. Returns CGRectZero if the print formatter draws no content on the specified page.

Parameters:

  • pageIndex (NSIndex)

    The index number of a page.

Returns:

  • (CGRect)

    A rectangle enclosing the content area for page pageIndex.

- (Object) removeFromPrintPageRenderer

Removes the print formatter from the page renderer. A print formatter is typically associated with a pages of a UIPrintPageRenderer object through the addPrintFormatter:startingAtPageAtIndex: method.

Returns: