Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #671 > unrolled thread

Printing two A5 pages to A4

Started byGerhard Trummer <gtrum@gmail.com>
First post2012-05-04 18:29 +0200
Last post2012-05-08 01:04 +0200
Articles 4 — 2 participants

Back to article view | Back to comp.lang.postscript


Contents

  Printing two A5 pages to A4 Gerhard Trummer <gtrum@gmail.com> - 2012-05-04 18:29 +0200
    Re: Printing two A5 pages to A4 Helge Blischke <h.blischke@acm.org> - 2012-05-04 20:44 +0200
      Re: Printing two A5 pages to A4 Gerhard Trummer <gtrum@gmail.com> - 2012-05-05 08:05 +0200
        Re: Printing two A5 pages to A4 Gerhard Trummer <gtrum@gmail.com> - 2012-05-08 01:04 +0200

#671 — Printing two A5 pages to A4

FromGerhard Trummer <gtrum@gmail.com>
Date2012-05-04 18:29 +0200
SubjectPrinting two A5 pages to A4
Message-ID<jo104u$o8a$1@news.albasani.net>
Hi,

I'm trying to print two A5 pages to A4 sheet (landscape), but it doesn't
work as expected.  Here is my test source:

$ cat a5.ps
%!PS-Adobe-3.0
%%BoundingBox: 0 0 420 595
%%Creator: GNU Emacs
%%Pages: 8
%%EndComments

%%BeginProlog
<< /PageSize [420 595] >> setpagedevice
/SetFont {/Helvetica-Bold findfont 288 scalefont setfont} def
/Frame {
    1 1 moveto 418 0 rlineto
    0 593 rlineto
    -418 0 rlineto
    closepath stroke
} def
%%EndProlog

%%Page: 1 1
Frame
SetFont 72 72 moveto (1) show
showpage

%%Page: 2 2
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (2) show
showpage

%%Page: 3 3
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (3) show
showpage

%%Page: 4 4
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (4) show
showpage

%%Page: 5 5
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (5) show
showpage

%%Page: 6 6
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (6) show
showpage

%%Page: 7 7
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (7) show
showpage

%%Page: 8 8
/Helvetica-Bold findfont 288 scalefont setfont
Frame
SetFont 72 72 moveto (8) show
showpage

%%EOF

It produces 8 pages A5 and is displayed as expected. But if I try to
print it:

$ lpr -P PDF -o "number-up=2 number-up-layout=lrtb page-set=odd" a5.ps

The media is A4 and landscape, but the two A5 pages are to small. It
seems Ghostscript thinks the original format is A4 not A5. I suppose my
source is wrong, but I can't figure out why.

What I really want to achieve is to produce the following output with a
small script:

| 1 3 | 5 7 |
| 8 6 | 4 2 |

in two batches, because my inkjet has no duplex printing and I'd like to
print two A5 pages (double-sided) on one A4 sheet and cut the pages in
half in the end. I use CUPS 1.5.2 and Ghostscript 9.05 on Linux. Can
anybody give me a clue?


G.

[toc] | [next] | [standalone]


#672

FromHelge Blischke <h.blischke@acm.org>
Date2012-05-04 20:44 +0200
Message-ID<a0imchFoijU1@mid.individual.net>
In reply to#671
Gerhard Trummer wrote:

> Hi,
> 
> I'm trying to print two A5 pages to A4 sheet (landscape), but it doesn't
> work as expected.  Here is my test source:
> 
> $ cat a5.ps
> %!PS-Adobe-3.0
> %%BoundingBox: 0 0 420 595
> %%Creator: GNU Emacs
> %%Pages: 8
> %%EndComments
> 
> %%BeginProlog
> << /PageSize [420 595] >> setpagedevice
> /SetFont {/Helvetica-Bold findfont 288 scalefont setfont} def
> /Frame {
>     1 1 moveto 418 0 rlineto
>     0 593 rlineto
>     -418 0 rlineto
>     closepath stroke
> } def
> %%EndProlog
> 
> %%Page: 1 1
> Frame
> SetFont 72 72 moveto (1) show
> showpage
> 
> %%Page: 2 2
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (2) show
> showpage
> 
> %%Page: 3 3
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (3) show
> showpage
> 
> %%Page: 4 4
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (4) show
> showpage
> 
> %%Page: 5 5
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (5) show
> showpage
> 
> %%Page: 6 6
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (6) show
> showpage
> 
> %%Page: 7 7
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (7) show
> showpage
> 
> %%Page: 8 8
> /Helvetica-Bold findfont 288 scalefont setfont
> Frame
> SetFont 72 72 moveto (8) show
> showpage
> 
> %%EOF
> 
> It produces 8 pages A5 and is displayed as expected. But if I try to
> print it:
> 
> $ lpr -P PDF -o "number-up=2 number-up-layout=lrtb page-set=odd" a5.ps
> 
> The media is A4 and landscape, but the two A5 pages are to small. It
> seems Ghostscript thinks the original format is A4 not A5. I suppose my
> source is wrong, but I can't figure out why.
> 
> What I really want to achieve is to produce the following output with a
> small script:
> 
> | 1 3 | 5 7 |
> | 8 6 | 4 2 |
> 
> in two batches, because my inkjet has no duplex printing and I'd like to
> print two A5 pages (double-sided) on one A4 sheet and cut the pages in
> half in the end. I use CUPS 1.5.2 and Ghostscript 9.05 on Linux. Can
> anybody give me a clue?
> 
> 
> G.

I assume you are using CUPS as the print spooler.
printing with the number-up option is implemented by scaling down the pages 
to be printed, i.e. with number-up=2, the pages are scaled down by sqrt(2).

To get your problem solved, you have two choices:
(1) set up your pages for A4 size and - if needed - make sure to print full 
bleed.
(2) program your imposition in PostScript (which is much mor an effort).

Helge

[toc] | [prev] | [next] | [standalone]


#673

FromGerhard Trummer <gtrum@gmail.com>
Date2012-05-05 08:05 +0200
Message-ID<jo2fvi$7vt$1@news.albasani.net>
In reply to#672
> To get your problem solved, you have two choices:
> (1) set up your pages for A4 size and - if needed - make sure to print full 
> bleed.
> (2) program your imposition in PostScript (which is much mor an effort).

Your second suggestion was my first idea before posting my question. But
according to `5001.DSC_Spec.pdf' on page 7:

»Use of the document structuring conventions not only helps assure that
a document is device independent, it allows PostScript language programs
to communicate their document structure and printing requirements to
document managers in a way that does not affect the PostScript language
page description.«

It's quite easy to do something like this:

/Pages 8 def
Pages {
  ...
} repeat

But then I loose the ability to place the corresponding `%%Page:'
comments within my PostScript program. I need an external script (e.g.
bash) for this task. Also the setting of `/PageSize' in my program
contradicts *device independence*. That's why I thought CUPS should be
the document manager. But besides the problem with the page size, CUPS
also can not deliver the intended sequence of pages (or I missed something).

Maybe I should give `psutils' a try...


G.

[toc] | [prev] | [next] | [standalone]


#674

FromGerhard Trummer <gtrum@gmail.com>
Date2012-05-08 01:04 +0200
Message-ID<jo9keq$9t5$1@news.albasani.net>
In reply to#673
> Maybe I should give `psutils' a try...

This does exactly what I want (if correct DSC are provided and page
descriptions are independent from each other as mentioned in my first
posting):

  # Index   0  1  2  3  4  5  6  7
  # Page    1  2  3  4  5  6  7  8
  # Block |-----1-----|-----2-----|
  pstops -q 4:3L(21cm,0)+1L(21cm,14.85cm) a5.ps | lp -s
  pstops -q 4:-0L(21cm,0)+-2L(21cm,14.85cm) a5.ps | lp -s

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web