The SAS Output Delivery System and reporting techniques

ODS PDF switch orientation between pages

Reply
Frequent Contributor
Posts: 99

ODS PDF switch orientation between pages

Hi,
I want my title page to have portrait orientation, but I want landscape orientation for the next page.

Thanks for the help in advance,

Amit
Super Contributor
Posts: 291

Re: ODS PDF switch orientation between pages

Amit;

Changing the options orientation= from portrait to landscape midstream does not work. You might be able to set up two ODS templates where one is "sized" to look like it's landscape and then use it for the first page while reverting back to another template for the portrait pages. I don't know if the ODS templates can be manipulated to do that. Something for you to explore. Please be sure to post your findings.

Something like:

options orientation=portrait;

ods pdf file='c:\temp\test.pdf' style=statistical;
*where the statistical template is a landscape template;

proc print data=sashelp.class;
run;

*options orientation=landscape;*this does not work;

ods pdf style=brick;

proc print data=sashelp.class;
run;

ods pdf close;

Bill
SAS Super FREQ
Posts: 8,864

Re: ODS PDF switch orientation between pages

Hi:
Only the RTF destination allows you to switch orientations in mid-stream. ODS PDF does not allow that.

There is nothing in the style template that would fool PDF into creating one page that was portrait and the next page/report that was landscape. So although you had a good idea, it is not really going to work the way you envisioned.

To switch orientations in midstream with ODS RTF, you have to do this:
[pre]
options orientation=portrait;

ods rtf file='twoway.rtf';

** first procedure;

options orientation=landscape;
ods rtf;

** second procedure;

ods rtf close;
[/pre]

Note that after you switch orientations, you must get ODS RTF to "refresh" the options by issuing an ODS RTF; statement without any other options on the statement. However, this technique does NOT work for ODS PDF.

cynthia
Contributor
Posts: 53

Re: ODS PDF switch orientation between pages

Posted in reply to Cynthia_sas
Hi Cynthia, I was also interesting in doing this in PDF. Are there any plans to add this in a future release?
SAS Super FREQ
Posts: 8,864

Re: ODS PDF switch orientation between pages

Hi, Frank:
I have no idea whether this is even possible. PDF files are in a proprietary form and my understanding of how ODS PDF works (conceptually) is that your output is formatted in some buffer area as though it was going to a physical printer and then that internal copy of the printer version of the file is sent to PDF proprietary format. So I don't know whether the Adobe proprietary format that ODS creates has that capability to switch orientations in midstream. My assumption is that if it were possible, the developers would have implemented the capability for PDF at the same time, or shortly after, they implemented it for RTF.

If you send a mail to ods@sas.com, you could ask the ODS developers whether it's a possibility or not.

cynthia
Contributor
Posts: 53

Re: ODS PDF switch orientation between pages

Posted in reply to Cynthia_sas
Excellent, thanks so much for your response. The only other thing I can think of is creating seperate PDF's, change the system orientation option in between, then somehow merging the two documents.. but I don't see that merge happening in SAS... Message was edited by: FrankE
SAS Super FREQ
Posts: 8,864

Re: ODS PDF switch orientation between pages

You're right, I expect you'd use some Adobe product or 3rd party PDF maker in order to put 2 separate PDF files together. It is a long-standing fact that you can ONLY append outputs using ODS HTML -- you can't append to ODS RTF or ODS PDF files using SAS. That's because the RTF spec and the PDF spec both have VERY rigid rules for what type of file/begin and file/end code is allowed in the output file.

cynthia
SAS Employee
Posts: 50

Re: ODS PDF switch orientation between pages

Posted in reply to Cynthia_sas
Good news!!! I have the orientation switch working in ODS PDF and it will be available in the next major release of SAS!!!
Super Contributor
Posts: 273

Re: ODS PDF switch orientation between pages

Scott,

Does this means 9.3? next year?

Andre
Contributor
Posts: 53

Re: ODS PDF switch orientation between pages

great news! I'm also curious on the time frame for this release...
SAS Employee
Posts: 50

Re: ODS PDF switch orientation between pages

We are currently shooting for availability right around SAS Global Forum
Ask a Question
Discussion stats
  • 10 replies
  • 1737 views
  • 1 like
  • 6 in conversation