[comp.sys.mac.programmer] Landscape printing?

) (01/09/89)

The Print Setup dialog now contains a button for "landscape printing" whose
state can be tested using the PrGeneral call.

What then?  Am I supposed to rotate the print image myself, or is there
support for landscaping in the Print Manager (or QuickDraw) itself.

If I have to do the dirty work, could anyone suggest a good strategy --
I know how to rotate a bitmap, but would like to know the best way
to proceed before: should I rotate each piece of text, then copy to
the print image, or build one big bitmap and rotate that?

Thanks in advance.

Martin Minow
minow%thundr.dec@decwrl.dec.com

parent@Apple.COM (Sean Parent) (01/10/89)

In article <8901081500.AA19025@decwrl.dec.com>, minow@thundr.dec.com (Repent! Godot is coming soon! Repent!) writes:
> The Print Setup dialog now contains a button for "landscape printing" whose
> state can be tested using the PrGeneral call.

It has always been there.

> What then?  Am I supposed to rotate the print image myself, or is there
> support for landscaping in the Print Manager (or QuickDraw) itself.

No. You do not rotate the image your self. The Driver will handle that. All
that you have to do is pay attention to the page size returned by the page set-
up call. i.e. The page for a US letter page will be 11 x 8 1/2 rather than 8
1/2 x 11. The reson for the PrGeneral call is for specific applications that
wanted to special case land scape printing. I see very little reason for it.

Sean

casseres@Apple.COM (David Casseres) (01/10/89)

In article <8901081500.AA19025@decwrl.dec.com> minow@thundr.dec.com (Repent! Godot is coming soon! Repent!) writes:
>The Print Setup dialog now contains a button for "landscape printing" whose
>state can be tested using the PrGeneral call.
>
>What then?  Am I supposed to rotate the print image myself....

No, flag that you test with PrGeneral tells you that the user has selected
landscape printing in the Page Setup dialog.  The printer driver will do the
rotation, all you have to do is format your document's content according to
the rotated page rectangle that you will find in the print record.

Nothing is new here except the ability to see a flag that tells you specif-
ically that the user has selected landscape format.

David Casseres

) (01/10/89)

I recently asked how to manage landscape printing -- my program would
put the page setup dialog on the screen, but the data would always be
printed in portrait format.  It turned out that I was reinitializing
PrDefault() each time my program opened the printer.  Here's a sketch
of a better way to do things (variables are missing):

THPrint		print_handle = NIL;

void
do_page_setup()		/* From the Page Setup menu option	*/
{
	open_printer();
	if (PrStlDialog(print_handle))
	    ;
	PrClose();
}

void
print_the_document()	/* From the Print menu option		*/
{
	open_printer();
	if (PrJobDialog(print_handle)) {
	    GetPort(&save_port);
	    number_of_copies = how_many_copies();
	    for (copy = 1; copy <= number_of_copies; copy++) {
		print_document();	/* You supply this!	*/
		if ((**print_handle).prJob.bJDocLoop == bSpoolLoop
		 && PrError() == noErr) {
		    PrPicFile(print_handle, NIL, NIL, NIL, &status);
	    }
	    SetPort(save_port);
	}
	PrClose();
}

int
how_many_copies()
{
	if ((**print_handle).prJob.bJDocLoop == bDraftLoop)
	    return ((**print_handle).PrJob.iCopies);
	else {
	    return (1);
	}
}

void
open_printer()		/* Initializes print_handle, too	*/
{
	PrOpen();
	if (PrError() != noErr) {
	    fatal_error("\pCannot open printer");
	    ExitToShell();
	}
	if (print_handle == NIL) {
	    print_handle = (TPrint **) NewHandle(sizeof (TPrint));
	    PrintDefault(print_handle);
	}
	PrValidate(print_handle);
}

Thanks to Larry Rosenstein and Walter Smith of Apple for suggestions.

Martin Minow
minow%thundr.dec@decwrl.dec.com

fjo@ttrdf.UUCP (Frank Owen ) (01/11/89)

in article <396@internal.Apple.COM>, casseres@Apple.COM (David Casseres) says:
> 
> Nothing is new here except the ability to see a flag that tells you specif-
> ically that the user has selected landscape format.

Just out of curiosity: what information does this give you that you cannot
get from the page rectangle in the print record?


-- 
Frank Owen (fjo@ttrdf)  312-982-2182
AT&T Bell Laboratories 
5555 Touhy Ave., Skokie, IL  60077
PATH:  ...!att!ttrdf!fjo

casseres@Apple.COM (David Casseres) (01/11/89)

In article <824@ttrdf.UUCP> fjo@ttrdf.UUCP (Frank Owen ) writes:
>in article <396@internal.Apple.COM>, casseres@Apple.COM (David Casseres) says:
>> 
>> Nothing is new here except the ability to see a flag that tells you specif-
>> ically that the user has selected landscape format.
>
>Just out of curiosity: what information does this give you that you cannot
>get from the page rectangle in the print record?

At first it seems that you can detect landscape printing because the width
will exceed the height in rPage, but then it turns out there are paper sizes,
such as envelope sizes and B5 size, that are wider than they are high in
normal orientation.

In other words, those beloved words "landscape" and "portrait" are misnomers
since we're not really talking about the shape of the page at all but about
whether or not the image is rotated.

That's why a couple of years ago we eliminated these words from the dialogs
and went to icon buttons instead... after rejecting a lot of other word pairs
like normal/rotated and upright/sideways.

David Casseres