[comp.sys.next] Scale view to fit widthwise on printed page

adonis1@nwnexus.WA.COM (Adonis Corporation ) (05/04/91)

Anyone know:

How does one scale a view so that it will fit width-wise on a printed page?

Using printPSCode, if my View object is too wide it gets clipped off on 
the right.

Thanks for any suggestions.

Doug Kent
Independent NeXT Developer
adonis1@nwnexus.wa.com

cgb@count0.uucp (cgb) (05/06/91)

In article <501@nwnexus.WA.COM> adonis1@nwnexus.WA.COM (Adonis Corporation ) writes:
>
>
>Anyone know:
>
>How does one scale a view so that it will fit width-wise on a printed page?
>
>Using printPSCode, if my View object is too wide it gets clipped off on 
>the right.
>
>Thanks for any suggestions.
>
>Doug Kent
>Independent NeXT Developer
>adonis1@nwnexus.wa.com

Try implementing the method 
- adjustPageWidthNew:left:right:limit

also setting

[ <printobj> setHorizPagination:NX_AUTOPAGINATION ];

Your getting clipped because that is the default for width (but not height.

Chuck

(just back from developers camp !! :-) )  It was great beyond words.


-- 
Cats, no less liquid than their shadows,
      Offer no angles to the wind.
They slip, diminished, neat, through loopholes
      Less than themselves.

scott@erick.gac.edu (Scott Hess) (05/06/91)

In article <501@nwnexus.WA.COM> adonis1@nwnexus.WA.COM (Adonis Corporation ) writes:
   Anyone know:

   How does one scale a view so that it will fit width-wise on a printed page?

   Using printPSCode, if my View object is too wide it gets clipped off on 
   the right.

This is a fun one!  What you want to do is adjust the pagination in
the application's printinfo.  Here's what I do in the printing
section of Stuart:

  PrintInfo *pi=[NXApp printInfo];
...
  [pi setHorizPagination:NX_FITPAGINATION];
  [pi setVertPagination:NX_AUTOPAGINATION];
  [pi setHorizCentered:YES];
  [pi setVertCentered:NO];

NX_FITPAGINATION tells it to scale the image as needed to fit.
This will only occur if the image is larger than the page.
NX_AUTOPAGINATION tells is to split into pages (that's the
default, I think).  I center it horizontally, in case it's
not wide enough to invoke the scaling.  I don't center
vertically, so it will go to the top of the page if it's too
short for the page.

I implemented this as part of the printPSCode: method that's
to do the printing.  Basically, you could do all this stuff
followed by 'return [super printPSCode:sender];', I believe.

Later,
--
scott hess                      scott@gac.edu
Independent NeXT Developer	GAC Undergrad	<almost out!>
<I still speak for nobody>