FROM : Stefan
DATE : Sun Aug 06 18:43:56 2006
Thx! No, I haven't, but I'll do immediately.
Am 06.08.2006 um 18:36 schrieb Todd Ransom:
> Have you looked at TextEdit? The rectForPage: method in
> MultiplePageView seems like it does what you want.
>
> On Aug 6, 2006, at 10:09 AM, Stefan wrote:
>
>>
>> Am 06.08.2006 um 17:57 schrieb Stefan:
>>
>>> I'll try to rephrase: My NSView subclass prints its content
>>> correctly, but does
>>> not get aligned to the top-left corner of the page nor resized to
>>> fit the printer's
>>> page size.
>>
>> I suppose my problem is related to this:
>>
>> >>>
>> // Return the drawing rectangle for a particular page number
>> - (NSRect)rectForPage:(int)page {
>> NSRect bounds = [self bounds];
>> float pageHeight = [self calculatePrintHeight];
>> return NSMakeRect( NSMinX(bounds), NSMaxY(bounds) - page *
>> pageHeight,
>> NSWidth(bounds), pageHeight );
>> }
>> <<<
>>
>> I never defined 'bounds', since my view is not on-screen.
>>
>> Shouldn't I tell my NSView subclass to set bounds according to the
>> printer's
>> paper size? But at which moment of time?
>>
>> The document's print operation gets started from within my
>> NSPersistentDocument
>> subclass:
>>
>> >>>
>> - (void)printShowingPrintPanel:(BOOL)showPanels {
>> // Obtain a custom view that will be printed
>>
>> [[self printInfo] setHorizontalPagination:NSAutoPagination];
>> [[self printInfo] setVerticalPagination:NSAutoPagination];
>>
>> // Construct the print operation and setup Print panel
>> NSPrintOperation *op = [NSPrintOperation
>> printOperationWithView:printView // <<<< THIS IS
>> MY VIEW TO GET PRINTED >>>
>> printInfo:[self printInfo]];
>> [op setShowPanels:showPanels];
>> if (showPanels) {
>> // Add accessory view, if needed
>> }
>>
>> // Run operation, which shows the Print panel if showPanels
>> was YES
>> [self runModalPrintOperation:op
>> delegate:nil
>> didRunSelector:NULL
>> contextInfo:NULL];
>> }
>> <<<
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>
DATE : Sun Aug 06 18:43:56 2006
Thx! No, I haven't, but I'll do immediately.
Am 06.08.2006 um 18:36 schrieb Todd Ransom:
> Have you looked at TextEdit? The rectForPage: method in
> MultiplePageView seems like it does what you want.
>
> On Aug 6, 2006, at 10:09 AM, Stefan wrote:
>
>>
>> Am 06.08.2006 um 17:57 schrieb Stefan:
>>
>>> I'll try to rephrase: My NSView subclass prints its content
>>> correctly, but does
>>> not get aligned to the top-left corner of the page nor resized to
>>> fit the printer's
>>> page size.
>>
>> I suppose my problem is related to this:
>>
>> >>>
>> // Return the drawing rectangle for a particular page number
>> - (NSRect)rectForPage:(int)page {
>> NSRect bounds = [self bounds];
>> float pageHeight = [self calculatePrintHeight];
>> return NSMakeRect( NSMinX(bounds), NSMaxY(bounds) - page *
>> pageHeight,
>> NSWidth(bounds), pageHeight );
>> }
>> <<<
>>
>> I never defined 'bounds', since my view is not on-screen.
>>
>> Shouldn't I tell my NSView subclass to set bounds according to the
>> printer's
>> paper size? But at which moment of time?
>>
>> The document's print operation gets started from within my
>> NSPersistentDocument
>> subclass:
>>
>> >>>
>> - (void)printShowingPrintPanel:(BOOL)showPanels {
>> // Obtain a custom view that will be printed
>>
>> [[self printInfo] setHorizontalPagination:NSAutoPagination];
>> [[self printInfo] setVerticalPagination:NSAutoPagination];
>>
>> // Construct the print operation and setup Print panel
>> NSPrintOperation *op = [NSPrintOperation
>> printOperationWithView:printView // <<<< THIS IS
>> MY VIEW TO GET PRINTED >>>
>> printInfo:[self printInfo]];
>> [op setShowPanels:showPanels];
>> if (showPanels) {
>> // Add accessory view, if needed
>> }
>>
>> // Run operation, which shows the Print panel if showPanels
>> was YES
>> [self runModalPrintOperation:op
>> delegate:nil
>> didRunSelector:NULL
>> contextInfo:NULL];
>> }
>> <<<
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Stefan | Aug 5, 12:34 | |
| Stefan | Aug 6, 17:41 | |
| Shawn Erickson | Aug 6, 17:53 | |
| Stefan | Aug 6, 17:57 | |
| Stefan | Aug 6, 18:09 | |
| Todd Ransom | Aug 6, 18:36 | |
| Stefan | Aug 6, 18:43 | |
| Stefan | Aug 6, 23:19 |






Cocoa mail archive

