6

how to set page size in the postscript? how to rotate the document to width? . .

%!
%% Example 1

newpath
100 200 moveto
200 250 lineto
100 300 lineto
2 setlinewidth
stroke

showpage

Thank you.

2 Answers2

7

To set the page size to A4 landscape use:

<< /PageSize [842 595] >> setpagedevice

before the first marking operator. Rotation is not needed.
Full PostScript reference is at http://www.adobe.com/products/postscript/pdfs/PLRM.pdf

Stefanov.sm
  • 11,215
  • 2
  • 21
  • 21
  • Any reason why this wouldn't work for a file? I used it earlier and it worked like a charm. I checked out the postscript reference and it seems link they might have removed the postscript reference pdf? – Shmack Mar 07 '21 at 01:36
  • The reason might be that the file contains code that inits the graphic system in its prolog section. The reference pdf can be found [here](https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/PLRM.pdf) – Stefanov.sm Mar 07 '21 at 17:29
  • I had too many `grestore`s so I guess it was popping it off the stack. – Shmack Mar 11 '21 at 16:22
1

To switch to landscape format:

Move origin from lower left to lower right corner, then rotate the coordinate system 90 degrees.

595 0 translate % 595 is width of A4 paper in points
90 rotate
Terje D.
  • 6,250
  • 1
  • 22
  • 30