• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing view content
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resizing view content


  • Subject: Re: Resizing view content
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Wed, 22 Oct 2003 19:14:12 +0100

On Wednesday, October 22, 2003, at 06:46 pm, John Timmer wrote:

In order to compensate for any changes the user makes in the HTLM formatting
and for the print orientation/paper size, I check the size of the webview's
document view, and scale it to fit the page width with NSView's
scaleUnitSquareToSize: method. When I do that, the width winds up great,
but I get whitespace (several pages worth on a large output) trailing the
print job - presumably the scaling left either the actual bounds or the
frame at the original height, but scaled the height of the contents as
requested.

OK. If you read the documentation for -scaleUnitSquareToSize:, you will see that it affects "the receiver's co-ordinate system" (i.e. the receiving view's bounds), and will indeed leave the frame the same as it was before (probably too wide as well as too tall, so you'll get quite a few blank pages).

Have you tried resizing the view's frame to match the scaling you applied to the internal co-ordinate system? Something like this, for example:

NSRect frame = [thePrintView frame];
NSSize newSize;
float scale = 0.63;

newSize = NSMakeSize (NSWidth (frame) * scale, NSHeight (frame) * scale);
[thePrintView setFrameSize:newSize];

NSLog (@"Original size: width %g, height %g\n"
@"New size: width %g, height %g\n",
NSWidth (frame), NSHeight (frame),
newSize.width, newSize.height);

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Resizing view content
      • From: John Timmer <email@hidden>
References: 
 >Re: Resizing view content (From: John Timmer <email@hidden>)

  • Prev by Date: Double click threshold in user defaults?
  • Next by Date: Re: Resizing view content
  • Previous by thread: Re: Resizing view content
  • Next by thread: Re: Resizing view content
  • Index(es):
    • Date
    • Thread