Your SAS programs, embedded in web apps and elsewhere

set explicit pdf papersize in web stored process

Accepted Solution Solved
Reply
Regular Contributor
Posts: 182
Accepted Solution

set explicit pdf papersize in web stored process

hi,

i have a stored process that i call from the web.

the stored process is created in EG and also deployed from EG.

the stored process generates a fancy pdf document with ods layout stuff applied.

when i call the stored process from a browser with US locale, the papersize is set to letter (see my previous question at https://communities.sas.com/message/180880#180880) causing the content to run off the pdf page.

i need to force papersize A4.

the obvious solution would be to set options papersize=a4 in my EG project, but i already did this and it doesn't work.

i think this is because when the stored process is deployed from EG, %stpbegin is inserted before all my code causing the ods pdf stream to already be opened with the letter papersize before my options papersize=a4 has the chance of altering it.

i can get it to work by manually editing the stored process source code and inserting the options papersize=a4 statement before the %stpbegin macro but i am not allowed to do that in our environment.

is there another way to dictate the papersize option in this scenario?

i would rather not deploy the stored process without the %stpbegin macro and code my own ods pdf statements.

thanks,

Bart


Accepted Solutions
Solution
‎09-16-2013 01:48 PM
Regular Contributor
Posts: 182

Re: set explicit pdf papersize in web stored process

_PRINTOPTIONS worked.

after some error checking, %stpbegin submits:

  %if (%qcmpres(&_STPERROR) eq 0) %then %do;

    options &_PRINTOPTIONS;

  %end;

i added a hidden parameter to the Stored Process with name "_printoptions" and default value "papapersize=a4" and now the pdf comes out in A4 regardless of browser locale.

View solution in original post


All Replies
Super User
Posts: 10,538

Re: set explicit pdf papersize in web stored process

What options are you passing to the %stpbegin macro? If I read the macro correctly it looks like you can send print options via the parameter _PRINTOPTIONS and it looks like PAPERSIZE should be accepted though I can't tell immediately what the syntax would be.

Solution
‎09-16-2013 01:48 PM
Regular Contributor
Posts: 182

Re: set explicit pdf papersize in web stored process

_PRINTOPTIONS worked.

after some error checking, %stpbegin submits:

  %if (%qcmpres(&_STPERROR) eq 0) %then %do;

    options &_PRINTOPTIONS;

  %end;

i added a hidden parameter to the Stored Process with name "_printoptions" and default value "papapersize=a4" and now the pdf comes out in A4 regardless of browser locale.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 528 views
  • 3 likes
  • 2 in conversation