• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

multiple paper size in postscript

New Here ,
Jun 16, 2008 Jun 16, 2008

Copy link to clipboard

Copied

I wanna use multiple page sizes in single Postscript document to do some scientific graphics. Is it possible with Postscript? Why the following code doesn't work?

%!PS-Adobe-3.0
%%Title: landscape PDF example
%%Pages: 3
%%EndComments
%%BeginProlog
%%EndProlog
%%BeginSetup
% Document information
[/CreationDate (D:20040224)
/Creator (Hand crafted by Russell Lang)
/Title (landpdf.ps) % note that GS can get title from DSC %%Title
/Subject (Example of landscape and portrait pages)
/Keywords (landscape portrait example Ghostscript DOCINFO)
/Author (Ghostgum Software Pty Ltd)
/DOCINFO pdfmark

%%EndSetup
%%Page: 1 1
% Set the page size to A4
<< /PageSize [595 842] >> setpagedevice
/Helvetica findfont 100 scalefont setfont
100 200 moveto (1 portrait) show
showpage

%%Page: 2 2
%%PageOrientation: landscape
% Set the page size to A3
<< /PageSize [842 1191] /Orientation 3 >> setpagedevice
90 rotate 0 -842 translate
/Helvetica findfont 100 scalefont setfont
100 200 moveto (2 landscape) show
showpage

%%Page: 3 3
% Set the page size to A4
<< /PageSize [595 842] >> setpagedevice
/Helvetica findfont 100 scalefont setfont
100 200 moveto (3 portrait) show
showpage

%%Trailer
%%EOF
TOPICS
Programming

Views

9.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2008 Jun 16, 2008

Copy link to clipboard

Copied

Define "doesn't work".

Aandi Inston

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2008 Jun 16, 2008

Copy link to clipboard

Copied

I use a pair ghostscript/ghostview to see output from my Postscript programs. When I run that program in this environment paper size remains the same for all three page although page orientation changes from Portrait to Landscape for middle page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

How do you know the page size is staying the same? Does GhostView
show the size on screen in inches/mm?

Aandi Inston

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

Yes, it is. May be I'm wrong, but scene prepared for A3 size cropped on boundary of page with size A4. Another hint that A3 paper size doesn't set follows from media menu with checked A4 item. Is it possible that this behaviour is a bug in ghostview(ghostscript)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

It might be, but this wouldn't be the best place to find out.

I tried your file with Acrobat Distiller. The pages were different
sizes, but Distiller does not use the orientation value you request to
rotate the page.

Aandi Inston

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

Ghostview (or gv on UNIces) interpretes the DSC comments. Try to insert
comments like

%%PageBoundingBox: 0 0 dx dy

after the %%Page: comments, where dx and dy are the page width and height as set up in the following setpagedevice statement, respectively. Then the pages will be displayed in different sizes.

If the orientation comments are interpreted correctly seems to depend on the version of Ghostview / gv.

Helge

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

This is a good point. The file is arguably faulty: the first line
asserts it is DSC compliant, but it lacks the necessary comments. Try
setting the first line to

%!

alone to see if the non-DSC processing is what you want.

Aandi Inston

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

OK. I see. Helge, Aandi, thank you for your help. Actually I'm revising my library for scientific Postscript imaging, that I wrote several years ago. I'm aware about Document Structuring Conventions published by Adobe and understood that I'm using out of date software to handle Postscript files and should spend some time to rebuild it. Here I post just a simplified example that reveals problem, my output is more complicated:

%!PS-Adobe-3.0
%%LanguageLevel: 2
%%BoundingBox: 40 212 802 977
%%Pages: 2
%%DocumentMedia: A4 595 842 80 white ( )
%%+ A3 842 1191 80 white ( )
%%Orientation: Portrait
%%EndComments
%%BeginDefaults
%%PageMedia: A4
%%PageOrientation: Portrait
%%EndDefaults
%%BeginSetup
<< /PageSize [595 842] >> setpagedevice
%%EndSetup
%%Page: (STAR5) 1
%%PageBoundingBox: 52 212 543 679
%%BeginPageSetup
save
%%EndPageSetup
0 setlinewidth
297.5 678.5 moveto
297.5 421 lineto
297.5 671.143 moveto
299.832 420.242 lineto
297.5 663.786 moveto
302.165 419.484 lineto
297.5 656.429 moveto
304.497 418.727 lineto
297.5 649.071 moveto
.....
246.603 489.07 moveto
296.059 490.441 lineto
247.048 490.441 moveto
297.5 490.441 lineto
stroke
restore
showpage
%%Page: (STAR6) 2
%%PageMedia: A3
%%PageBoundingBox: 1151 214 389 977
%%PageOrientation: Landscape
%%BeginPageSetup
<< /PageSize [842 1191] >> setpagedevice
save
90 rotate 0 -842 translate
%%EndPageSetup
0 setlinewidth
786 750.956 moveto
405 750.956 lineto
775.114 750.956 moveto
410.443 741.528 lineto
764.229 750.956 moveto
415.886 732.101 lineto
753.343 750.956 moveto
......
595.5 442.771 moveto
415.886 732.101 lineto
595.5 431.886 moveto
410.443 741.528 lineto
595.5 421 moveto
405 750.956 lineto
stroke
restore
showpage
%%Trailer
%%EOF

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2008 Jun 17, 2008

Copy link to clipboard

Copied

LATEST
Well, if the problem is just what is shown in GhostView, you should
probably refer to support (or source code) for that product. The exact
semantics of connecting a print language to a screen viewer are
dependent on the implementation - given Distiller behaves differently,
printers may be have differently again...

For a real device, page size control really requires PPD usage.

Aandi Inston

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines