🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #9297

Solution-- Converting to a new output size

#9297
From: James E. Burns
Date: Sat, 08 Jan 1994 04:02
107 lines
4394 bytes
There have been several recent queries about rescaling output from
one paper size to another.  One of the most interesting came from 
Thomas Muhr (muhr@cs.tu-berlin.de).  I sent him a quick hack I
had done at one time for printing an A5 document on letter (suitably
modified), but it failed.  Apparently, the new version of WordPerfect
hard-codes the target output size in the PS using setpagedevice (very nasty,
IMHO).  Anyway, after a couple of iterations, I managed to get
something that worked for Thomas.  I am posting it here so that
others might benefit from it.  (Maybe it could go into the FAQ?)
If you have a better solution for this recurring problem I would
be happy to hear about it.

jim burns

James E. Burns				   burns@nova.bellcore.com
Bellcore, NVC-3X114			   Off:  (908) 758-2819
331 Newman Springs Road			   Fax:  (908) 758-4371
Red Bank, NJ 07701-5699, USA		   Home: (908) 219-6561


%!
%  ppfix.ps
%
% Here is a quick hack to print documents created for one
% paper size on another.  Note that if the sizes are not
% very close graphics will be distorted.
%
% Just add this as a prefix to your document.
% (To retain pagination control, it should come AFTER the
% %%EndComments line, preferably in the %%BeginSetup section.)
%
% James E. Burns, 1/21/93,  burns@nova.bellcore.com
%  Revised 11/16/93 to avoid unneeded dictionary entries
%  Revised 12/30/93 to handle any given page sizes
%  Revised 1/6/92   to suppress pagedevice commands that block this hack
%  Revised 1/7/92   Removed unnecessary dictionary entries

systemdict begin
 [
  [
    % This sets the transformation matrix to scale to the new page size.
    % Exactly two of the following lines should be uncommented.
    % The first size will be scaled to the second.
    595  842   % A4
    % 612 1008  % legal
    % 792 1224  % 11x17
    % 516  729  % B5
    % 612  792  % letter
    % 612  792  % lettersmall
    420  595   % A5
    % 729 1032  % B4
    exch 4 -1 roll div
    3 1 roll exch div
    0.0 0.0 3 -1 roll
    % For some documents, it might be useful to add some translation
    % (i.e., replace the following two values.)
    0.0 0.0
  ]
%  dup == flush % (For testing)
  /concat load
]

cvx dup exec
/showpage [ /showpage load 4 3 roll /exec load ] cvx
end % systemdict
def

% The following is only needed if the software producing the PS
% output is nasty and uses machine dependent stuff (essentially,
% setpagedevice).  No guarantee that this won't cause you trouble!
% If any of this causes the code to break, try commenting out the
% stuff below.  On the other hand, if the rescaling has no effect
% you might need to add another similar line for some paper size I
% overlooked.
% NOTE: if you get an "invalidaccess" command from one of the def's
%  below (because the dict is not writable), try removing the
%  begin-end pairs around the def's and adding a 'pop' (see the
%  redefinition of /setpagedevice for an example).

/setpagedevice where { pop /setpagedevice {pop} def } if
/letter where { begin /letter{}def end} if
/lettersmall where { begin /lettersmall{}def end} if
/legal where { begin /legal{}def end} if
/ledger where { begin /ledger{}def end} if
/11x17 where { begin /11x17{}def end} if
/a4 where { begin /a4{}def end} if
/a4small where { begin /a4small{}def end} if
/a3 where { begin /a3{}def end} if
/a5 where { begin /a5{}def end} if
/b4 where { begin /b4{}def end} if
/b5 where { begin /b5{}def end} if

% End of ppfix.ps
--
James E. Burns				   burns@nova.bellcore.com
Bellcore, NVC-3X114			   Off:  (908) 758-2819
331 Newman Springs Road			   Fax:  (908) 758-4371
Red Bank, NJ 07701-5699, USA		   Home: (908) 219-6561




-- 
Thomas Muhr - Public Health (A4) - Technical University of Berlin
ATLAS/ti - Computer Supported Text Interpretation
FON: +49 30 314-27882   FAX: +49 30 8611415  E-MAIL: muhr@cs.tu-berlin.de
Technical Details
Message-ID: <BURNS.94Jan7230246@gauss.bellcore.com>
Path: arc1-ca.pugleaf.net!cs.tu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!uunet!walter!walter.bellcore.com!burns

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript
Path: arc1-ca.pugleaf.net!cs.tu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!uunet!walter!walter.bellcore.com!burns
From: burns@bellcore.com (James E. Burns)
Subject: Solution-- Converting to a new output size
Message-ID: <BURNS.94Jan7230246@gauss.bellcore.com>
Sender: news@walter.bellcore.com
Nntp-Posting-Host: gauss.bellcore.com
Organization: Bellcore
Date: Sat, 8 Jan 1994 04:02:46 GMT
Lines: 99