Your SAS programs, embedded in web apps and elsewhere

Forcing PDF file to open in a window

Accepted Solution Solved
Reply
PROC Star
Posts: 1,236
Accepted Solution

Forcing PDF file to open in a window

Hi,

I'm working on a stored-process that  a user will call from the Stored Process Web App, and will specify the _odsdest as pdf or html.  Process is running on the Stored Process Server.

As I've been playing with this, it seems like half the time I run it (from internent explorer), the PDF opens in a new IE window.  I like that.

But other times I run it, IE pops up a file download box asking me if I want to save do.pdf to my local drive.  Less useful.  I would like users to see the pdf, then decide whether they want to save it or not.

So how can I force IE to display the pdf?  Is this somethig I need to set with stpsrv_header, or do I need to change the SAS results type to be package only (currently both package and streaming are checked).  Or do I need to write the pdf file to the server somewhere, and then somehow open it?

Is there a ways I can give a name to the pdf (rather than do.pdf)?

The code is basically:

%global _odsdest;

%stpbegin;

proc print data=sashelp.class;

run;

%stpend;

With user specifying _odsdest=HTML or PDF.  And I use Cindy Z's %SetOpts macro to set some of the options, based on output destination.

Maybe I'd be better off going back to good old "ods pdf" / "ods html", rather than using %stpbegin??

Thanks,

-Q.


Accepted Solutions
Solution
‎05-01-2012 08:46 PM
SAS Super FREQ
Posts: 8,744

Re: Forcing PDF file to open in a window

Hi:

  Usually, you need to alter the STPSRV_HEADER to return PDF output using the SAS Stored Process Web App. In my paper, I did not show the use of STPSRV_HEADER because that macro was really only meant to give the general outline of how you would develop one stored process instead of 3 separate stored processes. And, the actual code was only ever submitted from SAS Enterprise Guide -- which did not need to have the STPSRV_HEADER set.

  Take a look at the code samples in this Tech Support note. You really would need to set STPSRV_HEADER for ODS PDF as shown here:

http://support.sas.com/kb/12/994.html

cynthia

View solution in original post


All Replies
Solution
‎05-01-2012 08:46 PM
SAS Super FREQ
Posts: 8,744

Re: Forcing PDF file to open in a window

Hi:

  Usually, you need to alter the STPSRV_HEADER to return PDF output using the SAS Stored Process Web App. In my paper, I did not show the use of STPSRV_HEADER because that macro was really only meant to give the general outline of how you would develop one stored process instead of 3 separate stored processes. And, the actual code was only ever submitted from SAS Enterprise Guide -- which did not need to have the STPSRV_HEADER set.

  Take a look at the code samples in this Tech Support note. You really would need to set STPSRV_HEADER for ODS PDF as shown here:

http://support.sas.com/kb/12/994.html

cynthia

PROC Star
Posts: 1,236

Re: Forcing PDF file to open in a window

Thanks Cynthia.  STPSRV_HEADER did the trick.  Your papers have been a big help as I explore stored processes.  And your ODS book holds a treasured space on my desk (I use it too often to bother puting it back on my shelf. : )

--Q.

Super Contributor
Posts: 1,636

Re: Forcing PDF file to open in a window

Hi,

Which book are you talking about? I need to buy one too.

Thanks - Linlin

PROC Star
Posts: 1,236

Re: Forcing PDF file to open in a window

"Output Delivery System: The Basics and Beyond", by Lauren Hayworth, Cynthia Zendler, and Michele M. Burlew.  Really good stuff.

Super Contributor
Posts: 1,636

Re: Forcing PDF file to open in a window

Thank you!!

Respected Advisor
Posts: 3,124

Re: Forcing PDF file to open in a window

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 480 views
  • 0 likes
  • 4 in conversation