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


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

Converting A4 into 2-page A3 spreads - PS code no longer working

Started byMichael Kilpatrick <news@mkilpatrick.cospam.uk>
First post2012-09-03 22:41 +0100
Last post2012-09-05 16:43 +0100
Articles 20 on this page of 22 — 5 participants

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


Contents

  Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-03 22:41 +0100
    Re: Converting A4 into 2-page A3 spreads - PS code no longer working tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-03 19:40 -0400
      Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-04 13:41 +0100
        Re: Converting A4 into 2-page A3 spreads - PS code no longer working tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-04 23:34 -0400
          Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 13:36 +0100
            Re: Converting A4 into 2-page A3 spreads - PS code no longer working tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-05 23:26 -0400
    Re: Converting A4 into 2-page A3 spreads - PS code no longer working Luser droog <mijoryx@yahoo.com> - 2012-09-03 23:01 -0500
      Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-04 13:59 +0100
    Re: Converting A4 into 2-page A3 spreads - PS code no longer working SaGS <sags5495@gmail.com> - 2012-09-03 22:40 -0700
      Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-04 15:25 +0100
    Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-04 19:49 +0100
      Re: Converting A4 into 2-page A3 spreads - PS code no longer working Helge Blischke <h.blischke@acm.org> - 2012-09-04 21:45 +0200
      Re: Converting A4 into 2-page A3 spreads - PS code no longer working SaGS <sags5495@gmail.com> - 2012-09-04 22:43 -0700
        Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 09:28 +0100
          Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 09:38 +0100
            Re: Converting A4 into 2-page A3 spreads - PS code no longer working SaGS <sags5495@gmail.com> - 2012-09-05 06:19 -0700
          Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 10:07 +0100
            Re: Converting A4 into 2-page A3 spreads - PS code no longer working SaGS <sags5495@gmail.com> - 2012-09-05 06:09 -0700
              Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 15:16 +0100
                Re: Converting A4 into 2-page A3 spreads - PS code no longer working SaGS <sags5495@gmail.com> - 2012-09-05 11:25 -0700
                  Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 20:25 +0100
    Re: Converting A4 into 2-page A3 spreads - PS code no longer working Michael Kilpatrick <news@mkilpatrick.cospam.uk> - 2012-09-05 16:43 +0100

Page 1 of 2  [1] 2  Next page →


#915 — Converting A4 into 2-page A3 spreads - PS code no longer working

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-03 22:41 +0100
SubjectConverting A4 into 2-page A3 spreads - PS code no longer working
Message-ID<mOidnTPP7K6RudjNnZ2dnUVZ8sKdnZ2d@brightview.co.uk>
Hello all,

about seven years ago a man called Chapman Flack, on this newsgroup, 
gave me some help with Postscript code - which I never quite understood. 
Now, it has simply stopped working. If anyone can help, please can they 
have a look?

The task is relatively simple: in Windows XP, I use Sibelius music 
software and print to a HP LaserJet 5100 print which has both A3 and A4 
paper. The Sibelius documents are of any number of A4 pages which I wish 
to become a number of A3 pages (as 2-page spreads) plus a A4 page if 
there were an odd number of pages to start with.

This is acheived with some PHP code to mangle the PS en route, using a 
redirected port to act as a Windows printer. The PHP script inserts some 
PS code and also counts the number of A4 pages and alters a flag //true 
or //false in the PS code to account for the documents which have either 
even or odd numbers of pages.

Hey presto, I have a mixture of A3 and A4 pages being delivered at one 
click of the "print" button.

It used to work all the time.

A few years ago it started failing intermittently. Now, the HP 5100 PS 
driver doesn't work at all and I've changing to the Universal Print 
Driver, which seems to work.

However, the PS is obviously invalid, and trying to run it through Adobe 
Acrobat confirms that.

The Acrobat error is:

"%%[ Error: invalidaccess; OffendingCommand: >> ]%%"

And the offending ">>" is the 20th line in the code below. I determine 
this by simply sticking the word "fish" after ">> setpagedevice"!


I don't really understand the code, but there certainly seem to be the 
correct number of { }, [ ] and << >>, so the syntax looks good.

Can anyone see what might be going wrong?





vmstatus pop pop 0 eq { save pop } if
currentglobal true setglobal
<<  /ODD [ //true ] % or //false, set according to the pagecount
/postshow [ null ]
  >> dup begin
/showpage { showpage //postshow 0 get dup null eq { pop } {
     //postshow 0 null put exec
    } ifelse
   } bind end def begin
   //ODD 0 get {
     << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
     >> setpagedevice
     //postshow 0 {
       << /PageSize [ 420 72 25.4 div mul 297 72 25.4 div mul ]
       >> setpagedevice
       //ODD 0 //false put
       } bind put
     } {
     << /PageSize [ 420 72 25.4 div mul 297 72 25.4 div mul ]
     >>
     setpagedevice
     } ifelse
   << /BeginPage { 2 mod 1 eq { 210 72 25.4 div mul 0 translate
   } if
} bind
/EndPage { 0 eq exch 2 mod 1 eq //ODD 0 get or and } bind
 >> setpagedevice
end setglobal  /setpagedevice { pop } bind def



thanks,

Michael  @ mkilpatrick.co.uk

[toc] | [next] | [standalone]


#917

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2012-09-03 19:40 -0400
Message-ID<wz3p3fyy9wbt$.vkg8lunqqt9x$.dlg@40tude.net>
In reply to#915
On Mon, 03 Sep 2012 22:41:24 +0100, Michael Kilpatrick wrote:

> Hello all,
> 
> about seven years ago a man called Chapman Flack, on this newsgroup, 
> gave me some help with Postscript code - which I never quite understood. 
> Now, it has simply stopped working. If anyone can help, please can they 
> have a look?
> 
> The task is relatively simple: in Windows XP, I use Sibelius music 
> software and print to a HP LaserJet 5100 print which has both A3 and A4 
> paper. The Sibelius documents are of any number of A4 pages which I wish 
> to become a number of A3 pages (as 2-page spreads) plus a A4 page if 
> there were an odd number of pages to start with.

Let me snip your tale of what used to work for you (but no longer does) and
offer you a quick description of the workaround I use for a very similar
[two-up]-ing of pairs of half-letter pages onto individual letter pages --
modify to suit your needs:

First, I gather together all the half-letter pages that need to be
assembled, padding them at one end or the other, if there's an odd number
of them, with one blank half-letter page: that makes one PDF file.

I open it in my preferred PDF file viewer -- perhaps Adobe's Acrobat
Reader, perhaps Tracker Software's PDF X-Change Viewer, perhaps other --
and set about printing it through the BullZIP PDF printer, w/ output setup:
letter paper, two pages per sheet, no reduction (or 100% scaling). Poof:
half the original number of PDF pages, letter size, each showing two of the
original half-letter pages side-by-side.

So long as A3 is an acceptable paper size for your installation of BullZIP,
the technique above modified to your paper sizes should work.

If however A3 isn't an option, or if you don't have / can't get BullZIP,
you might try instead using the Print-To-File option for another HP
Tabloid-capable PS printer, like the HP 8500. I've used that printer driver
with considerable success for getting PS streams recorded via Print-To-File
for ultimately Distilling to tabloid-sized PDF -- that's two steps, of
course, whereas BullZIP would do it in one. 

(Tabloid, fwiw, is 11" x 17", close kin to A3.)

Sorry I can't help out with your code -- but perhaps the above work-around
will fill the bill for you nearly as well.

HTH. Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

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


#921

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-04 13:41 +0100
Message-ID<2O2dnSrJQvF4a9jNnZ2dnUVZ8jKdnZ2d@brightview.co.uk>
In reply to#917
On 04/09/2012 00:40, tlvp wrote:

> First, I gather together all the half-letter pages that need to be
> assembled, padding them at one end or the other, if there's an odd number
> of them, with one blank half-letter page: that makes one PDF file.
>
> I open it in my preferred PDF file viewer -- perhaps Adobe's Acrobat
> Reader, perhaps Tracker Software's PDF X-Change Viewer, perhaps other --
> and set about printing it through the BullZIP PDF printer, w/ output setup:
> letter paper, two pages per sheet, no reduction (or 100% scaling). Poof:
> half the original number of PDF pages, letter size, each showing two of the
> original half-letter pages side-by-side.
>

Thanks for your reply, although I'm not quite sure I follow you.

I am printing a set of 17 parts for my jazz orchestra. Or I might be 
printing just a replacement part for one of the 17 instruments. Each of 
the 17 parts is one print job and might be 1,2,3,4 sides of A4 which I 
want to tape together as spreads, preferably using 2 sheets of A3 
instead of four sheets of A4 for a 4-page piano part.

Therefore to print a set of parts out for a new piece I need 17 print 
jobs and to process each one separately to do the 2-up business (as 
necessary).

I can't "gather together" any pages.

Michael

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


#932

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2012-09-04 23:34 -0400
Message-ID<1s8cg51hdilye$.13vvvbvwbmzy7.dlg@40tude.net>
In reply to#921
On Tue, 04 Sep 2012 13:41:00 +0100, Michael Kilpatrick wrote:

> On 04/09/2012 00:40, tlvp wrote:
> 
>> First, I gather together all the half-letter pages that need to be
>> assembled, padding them at one end or the other, if there's an odd number
>> of them, with one blank half-letter page: that makes one PDF file.
>>
>> I open it in my preferred PDF file viewer -- perhaps Adobe's Acrobat
>> Reader, perhaps Tracker Software's PDF X-Change Viewer, perhaps other --
>> and set about printing it through the BullZIP PDF printer, w/ output setup:
>> letter paper, two pages per sheet, no reduction (or 100% scaling). Poof:
>> half the original number of PDF pages, letter size, each showing two of the
>> original half-letter pages side-by-side.
>>
> 
> Thanks for your reply, although I'm not quite sure I follow you.
> 
> I am printing a set of 17 parts for my jazz orchestra. Or I might be 
> printing just a replacement part for one of the 17 instruments. Each of 
> the 17 parts is one print job and might be 1,2,3,4 sides of A4 which I 
> want to tape together as spreads, preferably using 2 sheets of A3 
> instead of four sheets of A4 for a 4-page piano part.
> 
> Therefore to print a set of parts out for a new piece I need 17 print 
> jobs and to process each one separately to do the 2-up business (as 
> necessary).
> 
> I can't "gather together" any pages.
> 
> Michael

Sorry, I was too rushed and/or cryptic in my description. I try again.

Let me focus on just one particular part (for one of your 17 instruments).
I don't know whether that part is already in the form of a PDF file for a
given number of A4 pages, a PS file for that many A4 pages, or a clutch of
individual A4 page files in PDF or in PS. But I would begin by assembling
into one A4 PDF with an *even* number of pages all the pages that part
requires (along with one blank A4 page, at the end say, if there were only
an odd number of pages to that part to start with).

(If necessary, I'd distill the PS to PDF; and, if there are just single PDF
pages at this point, I'd use acrobat -- or pdftk -- to assemble them into
one multi-page PDF.)

Then I'd either "print" that PDF (consisting of an even number of A4
pages), using BullZIP, two up, onto A3 pages, as a PDF; or, alternatively,
I'd follow the two-step procedure of printing that PDF "to file" using an
A3 or Tabloid size capable PS printer driver (like that for HP 8500) and
then distill that to an A3 PDF.

'Zat make any better sense than my first attempt earlier?

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

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


#936

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-05 13:36 +0100
Message-ID<Vv-dnVD3fY_42trNnZ2dnUVZ7v-dnZ2d@brightview.co.uk>
In reply to#932
On 05/09/2012 04:34, tlvp wrote:
>
> Then I'd either "print" that PDF (consisting of an even number of A4
> pages), using BullZIP, two up,

Sorry, but I don't get it. I've installed BullZIP and tried printing a 
2-up from within Sibelius - but it places at border around the pages! I 
can't see how to stop that, so it doesn't sugest to me that it won't do 
the same if I can use BullZIP within a script!

All I want is just plain 2-up. I don't want the two pages of A4 shrunk 
at all to fit (which is what happens when I try printing 2-up directly 
to the printer) or a border.

This is getting quite infuriating, it has to be said.

Michael

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


#944

Fromtlvp <mPiOsUcB.EtLlLvEp@att.net>
Date2012-09-05 23:26 -0400
Message-ID<7rirm1zgig0$.1imybaxwyotkc.dlg@40tude.net>
In reply to#936
On Wed, 05 Sep 2012 13:36:52 +0100, Michael Kilpatrick wrote:

> On 05/09/2012 04:34, tlvp wrote:
>>
>> Then I'd either "print" that PDF (consisting of an even number of A4
>> pages), using BullZIP, two up,
> 
> Sorry, but I don't get it. I've installed BullZIP and tried printing a 
> 2-up from within Sibelius - but it places at border around the pages! I 

A border ??? I've never had that happen to me, I'm happy to say ... but
consequently I'm at a loss what to do to prevent that happening to you.
Could either BullZIP or Sibelius have an option hiding somewhere to turn
off bordering of printed pages?

> can't see how to stop that, so it doesn't sugest to me that it won't do 
> the same if I can use BullZIP within a script!
> 
> All I want is just plain 2-up. I don't want the two pages of A4 shrunk 

That much at least -- no shrinking -- the BullZIP (as well as the
print-to-file-using-HP-8500-PS-driver) approach delivers.

> at all to fit (which is what happens when I try printing 2-up directly 
> to the printer) or a border.

That border's a mystery to me, sorry.

> This is getting quite infuriating, it has to be said.

I quite believe it. But it'll make a useful blog once you get it sorted.

> Michael

Cheers, -- tlvp
-- 
Avant de repondre, jeter la poubelle, SVP.

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


#919

FromLuser droog <mijoryx@yahoo.com>
Date2012-09-03 23:01 -0500
Message-ID<k23ued$r9t$1@adenine.netfront.net>
In reply to#915
Michael Kilpatrick wrote:

> Hello all,
> 
> about seven years ago a man called Chapman Flack, on this newsgroup,
> gave me some help with Postscript code - which I never quite understood.
> Now, it has simply stopped working. If anyone can help, please can they
> have a look?
> 
> The task is relatively simple: in Windows XP, I use Sibelius music
> software and print to a HP LaserJet 5100 print which has both A3 and A4
> paper. The Sibelius documents are of any number of A4 pages which I wish
> to become a number of A3 pages (as 2-page spreads) plus a A4 page if
> there were an odd number of pages to start with.
> 
> This is acheived with some PHP code to mangle the PS en route, using a
> redirected port to act as a Windows printer. The PHP script inserts some
> PS code and also counts the number of A4 pages and alters a flag //true
> or //false in the PS code to account for the documents which have either
> even or odd numbers of pages.
> 
> Hey presto, I have a mixture of A3 and A4 pages being delivered at one
> click of the "print" button.
> 
> It used to work all the time.
> 
> A few years ago it started failing intermittently. Now, the HP 5100 PS
> driver doesn't work at all and I've changing to the Universal Print
> Driver, which seems to work.
> 
> However, the PS is obviously invalid, and trying to run it through Adobe
> Acrobat confirms that.
> 
> The Acrobat error is:
> 
> "%%[ Error: invalidaccess; OffendingCommand: >> ]%%"
> 

From the PS side, /invalidaccess is one of the more rare errors you're
likely to encounter. And to happen in '>>'! The dictionary creation
operator! That's got to mean that the PS interpreter doesn't like 
creating all these global dictionaries. IIRC, that is one of the no-nos
for EPS and DSC-conformance. It's kind of like the radio trying to 
operate the clutch.

> And the offending ">>" is the 20th line in the code below. I determine
> this by simply sticking the word "fish" after ">> setpagedevice"!
> 

Your diagnostic doesn't seem conclusive to me. It could be any of the '>>'s.
And it's probably the "first" one (ie. time-wise, not necessarily in that
physical order in the source code).

> 
> I don't really understand the code, but there certainly seem to be the
> correct number of { }, [ ] and << >>, so the syntax looks good.
> 
> Can anyone see what might be going wrong?
> 
> 
> 
> 
> 
> vmstatus pop pop 0 eq { save pop } if
> currentglobal true setglobal
                  ^
If you change this| 'true' to 'false', that just may let the thing work.

The rest looks ok, although I didn't read it too closely (I didn't "run it"
in my head :). The only real improvement I could see making to the code
would be to generalize it to discover the current page parameters and
impose on any page-size.

Hmm. Actually, it looks like it may or may-not leave a save object
on the stack at the end. No, nevermind, 'save pop'. I see it now. :)

> <<  /ODD [ //true ] % or //false, set according to the pagecount
> /postshow [ null ]
>   >> dup begin
> /showpage { showpage //postshow 0 get dup null eq { pop } {
>      //postshow 0 null put exec
>     } ifelse
>    } bind end def begin
>    //ODD 0 get {
>      << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
>      >> setpagedevice
>      //postshow 0 {
>        << /PageSize [ 420 72 25.4 div mul 297 72 25.4 div mul ]
>        >> setpagedevice
>        //ODD 0 //false put
>        } bind put
>      } {
>      << /PageSize [ 420 72 25.4 div mul 297 72 25.4 div mul ]
>      >>
>      setpagedevice
>      } ifelse
>    << /BeginPage { 2 mod 1 eq { 210 72 25.4 div mul 0 translate
>    } if
> } bind
> /EndPage { 0 eq exch 2 mod 1 eq //ODD 0 get or and } bind
>  >> setpagedevice
> end setglobal  /setpagedevice { pop } bind def
> 
> 
> 
> thanks,
> 
> Michael  @ mkilpatrick.co.uk


--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

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


#922

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-04 13:59 +0100
Message-ID<Zt6dnWuH0KSrZtjNnZ2dnUVZ8oidnZ2d@brightview.co.uk>
In reply to#919
On 04/09/2012 05:01, Luser droog wrote:
> Michael Kilpatrick wrote:
>

>> However, the PS is obviously invalid, and trying to run it through Adobe
>> Acrobat confirms that.
>>
>> The Acrobat error is:
>>
>> "%%[ Error: invalidaccess; OffendingCommand: >> ]%%"
>>
>
>  From the PS side, /invalidaccess is one of the more rare errors you're
> likely to encounter. And to happen in '>>'! The dictionary creation
> operator! That's got to mean that the PS interpreter doesn't like
> creating all these global dictionaries. IIRC, that is one of the no-nos
> for EPS and DSC-conformance. It's kind of like the radio trying to
> operate the clutch.

>> And the offending ">>" is the 20th line in the code below. I determine
>> this by simply sticking the word "fish" after ">> setpagedevice"!
>>
>
> Your diagnostic doesn't seem conclusive to me.

Well, no, all it proves is that the intrepreter gets as far as reading 
that ">> setpagedevice fish" before exploding. If I put the word "fish" 
anywhere earlier in the PS file the intrepreter declares that "fish" is 
the offending command, not ">>".

Of course, with a stack-based language (whose syntax I can barely 
follow) this doesn't really tell me where the *real* problem is!


>> vmstatus pop pop 0 eq { save pop } if
>> currentglobal true setglobal
>                    ^
> If you change this| 'true' to 'false', that just may let the thing work.


Ah, I'm sort of making progess!!!


With the above change, no documents with even numbers of pages were 
pritned. The printer receives the data but discards it - the "processing 
job" display appears for second, then nothing happens.

However, Adobe Acrobat correctly converts them to a 2-page or 4-page 
spread PDF on A3, which is good news.

If I try a 3-page document, the printer accepts the job but it goes wrong.

It prints the first page (on A4) then prins a blank A4 page, then prints 
another A4 sheet with the following report in plain text

"ERROR: configurationerror
OFFENDING COMMAND: setpagedevice

STACK:
-dictiomnary-"

However, Adobe Acrobat correctly reads the Postscript and produces a PDF 
which has one page of A4 followed by an A3 page with 2-up A4 sides!!

Wow, so, something at least has improved.

Clearly my printer doesn't like something that Adobe Acrobat Distiller 
(6.0) can cope with?

Michael

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


#920

FromSaGS <sags5495@gmail.com>
Date2012-09-03 22:40 -0700
Message-ID<f1a91fde-3923-4b3b-a55a-d4f805dfa4fe@gk4g2000vbb.googlegroups.com>
In reply to#915
On Sep 4, 12:41 am, Michael Kilpatrick <n...@mkilpatrick.cospam.uk>
wrote:
> ...
> This is acheived with some PHP code to mangle the PS en route, using a
> redirected port to act as a Windows printer. The PHP script inserts some
> PS code and also counts the number of A4 pages and alters a flag //true
> or //false in the PS code to account for the documents which have either
> even or odd numbers of pages.
>
> Hey presto, I have a mixture of A3 and A4 pages being delivered at one
> click of the "print" button.
>
> It used to work all the time.
> ...
> A few years ago it started failing intermittently. Now, the HP 5100 PS
> driver doesn't work at all and I've changing to the Universal Print
> Driver, which seems to work.
>
> However, the PS is obviously invalid, and trying to run it through Adobe
> Acrobat confirms that.
>
> The Acrobat error is:
>
> "%%[ Error: invalidaccess; OffendingCommand: >> ]%%"
> ...

Without a sample file, I can only try to guess. The best would be you
put a sample PostScript file (the smaller that exhibits the problem)
somewhere on the web, publicly available, and post the URL here.

That being said, I find 2 possible problems on the PostScript side,
listed below. Of course the real cause could be very different. From
what you say, I assume that Perl code does some find'n'replace. Since
you did not change the printer (and thus the PostScript interpreter is
exactly the same) but you changed drivers (so the exact PS code
differs), it's possible this find'n'replace does not work well
anymore.


(A) With Ghostscript at least, showpage does not like its argument to
be in global VM

I found something in the "PostScript Reference Manual" that could
indicate this is implementation-dependent.

Try constructing the dictionaries passed to showpage in local VM.
Change things like

    << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
    >> setpagedevice

to

    currentglobal false setglobal
    << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
    >> setpagedevice
    setglobal

(There are 4 setpagedevice calls, the last one is longer "<< /
BeginPage ... /EndPage ... bind >> setpagedevice".)


(B) Infinite recursion in showpage

Could happen if showpage is already redefined as a procedure before
your code. It's unlikely for this to be the problem here, I would
expect an execstackoverflow if it were the case.


Hope that helps,
sags

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


#923

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-04 15:25 +0100
Message-ID<37idnfhrl4rQktvNnZ2dnUVZ8sOdnZ2d@brightview.co.uk>
In reply to#920
On 04/09/2012 06:40, SaGS wrote:

> Without a sample file, I can only try to guess. The best would be you
> put a sample PostScript file (the smaller that exhibits the problem)
> somewhere on the web, publicly available, and post the URL here.
>

>
> Try constructing the dictionaries passed to showpage in local VM.
> Change things like
>
>      << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
>      >> setpagedevice
>
> to
>
>      currentglobal false setglobal
>      << /PageSize [ 210 72 25.4 div mul 297 72 25.4 div mul ]
>      >> setpagedevice
>      setglobal
>
> (There are 4 setpagedevice calls, the last one is longer "<< /
> BeginPage ... /EndPage ... bind >> setpagedevice".)

I've done that. I've also tried with both "false" and "true" in the 2nd 
line of the original code "currentglobal true setglobal" as suggested by 
Luser droog in his reply above.


In both cases, the result is the same. Documents with even numbers of 
pages get swallowed by the printer. Odd numbers get printed but 
incorrectly. In both cases Adobe Acrobat does manage to make a valid PDF 
(with both A4 and A3 pages where appropriate).

>
> (B) Infinite recursion in showpage
>
> Could happen if showpage is already redefined as a procedure before
> your code. It's unlikely for this to be the problem here, I would
> expect an execstackoverflow if it were the case.

The code is inserted at the very top of the document, right after the 
first line which is "%!PS-Adobe-3.0".

So, I'm non the wiser, sadly, as to what is wrong. Something to do with 
the printer, surely, given that Acrobat Distiller is capable of getting 
it right?

I wonder if I updated the printer firmware at any. I really can't recall.


Michael

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


#927

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-04 19:49 +0100
Message-ID<OpmdnU_HYPrS0NvNnZ2dnUVZ7v2dnZ2d@brightview.co.uk>
In reply to#915
Hmmm, I'm afraid I haven't a clue how to go about solving this problem.

I have installed an Adobe generic PS driver but it only appears to be PS 
level 2.

So, I have uploaded some files to the web - an example of a 2-page 
document and an example of a 3-page document, each printed using both 
the HP Universal PS driver and the Adobe PS driver:

http://www.ellington-music.co.uk/graphics/Adobe2pages.ps
http://www.ellington-music.co.uk/graphics/Adobe3pages.ps
http://www.ellington-music.co.uk/graphics/HP2pages.ps
http://www.ellington-music.co.uk/graphics/HP3pages.ps

Then I have manually created the version of the file which my PHP script 
makes, to incorporate the code (which I've done using Sags' suggested 
modifications):

http://www.ellington-music.co.uk/graphics/HP2pages-processed.ps
http://www.ellington-music.co.uk/graphics/HP3pages-processed.ps

Those files both correctly make PDFs if I run Adobe Acrobat.

However, none of the files don't work with PSUtils.

If, for example, I do either of these:

psselect -p2 HP2pages.ps output.ps
psselect -p2 HP2pages-processed.ps output.ps

then the output.ps file, when run through Adobe Acrobat, bombs out with 
an error like this:

  %%[ Error: undefined; OffendingCommand: AddT42Char ]%%

So that tells me nothing other than the postscript is originally 
compatible with Acrobat but not my printer, and does not produce 
Acrobat-compatible code if it is run through psselect.

Great, I'm non the wiser over any of this...

Michael

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


#928

FromHelge Blischke <h.blischke@acm.org>
Date2012-09-04 21:45 +0200
Message-ID<aan43aF58bU1@mid.individual.net>
In reply to#927
Michael Kilpatrick wrote:

> Hmmm, I'm afraid I haven't a clue how to go about solving this problem.
> 
> I have installed an Adobe generic PS driver but it only appears to be PS
> level 2.
> 
> So, I have uploaded some files to the web - an example of a 2-page
> document and an example of a 3-page document, each printed using both
> the HP Universal PS driver and the Adobe PS driver:
> 
> http://www.ellington-music.co.uk/graphics/Adobe2pages.ps
> http://www.ellington-music.co.uk/graphics/Adobe3pages.ps
> http://www.ellington-music.co.uk/graphics/HP2pages.ps
> http://www.ellington-music.co.uk/graphics/HP3pages.ps
> 
> Then I have manually created the version of the file which my PHP script
> makes, to incorporate the code (which I've done using Sags' suggested
> modifications):
> 
> http://www.ellington-music.co.uk/graphics/HP2pages-processed.ps
> http://www.ellington-music.co.uk/graphics/HP3pages-processed.ps
> 
> Those files both correctly make PDFs if I run Adobe Acrobat.
> 
> However, none of the files don't work with PSUtils.
> 
> If, for example, I do either of these:
> 
> psselect -p2 HP2pages.ps output.ps
> psselect -p2 HP2pages-processed.ps output.ps
> 
> then the output.ps file, when run through Adobe Acrobat, bombs out with
> an error like this:
> 
>   %%[ Error: undefined; OffendingCommand: AddT42Char ]%%
> 
> So that tells me nothing other than the postscript is originally
> compatible with Acrobat but not my printer, and does not produce
> Acrobat-compatible code if it is run through psselect.
> 
> Great, I'm non the wiser over any of this...
> 
> Michael

The problems mainly stem from the fact that the source files (i. e. before 
your manipulations) are not really DSC conpliant. Especially the fact that 
the first page contains definitions which are used in the following pages 
leads to unefined errors like that you mentioned.

There is not much you can do but make the files DSC compliant. 
Please drop me an e-mail if I should try to modify your files accordingly (I 
have a CUPS filter for doing that, but the description of it is only in 
German).

Helge

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


#930

FromSaGS <sags5495@gmail.com>
Date2012-09-04 22:43 -0700
Message-ID<0fb872b1-00aa-4b04-8b37-400d1afeb615@t4g2000vba.googlegroups.com>
In reply to#927
On Sep 4, 9:49 pm, Michael Kilpatrick <n...@mkilpatrick.cospam.uk>
wrote:
> ...
> However, none of the files don't work with PSUtils.
>
> If, for example, I do either of these:
>
> psselect -p2 HP2pages.ps output.ps
> psselect -p2 HP2pages-processed.ps output.ps
>
> then the output.ps file, when run through Adobe Acrobat, bombs out with
> an error like this:
>
>   %%[ Error: undefined; OffendingCommand: AddT42Char ]%%
> ...

The "%%PageOrder: Special" comment found in these file specifies that
pages are not independent so you cannot reorder/ extract/ etc pages
from the file. The Windows PostScript driver generates this type of
file if "Printing Preferences"/ "Advanced"/ "PostScript Output
Option" (wording is for WinXP, may differ for other versions) for that
printer is set to "Optimize for Speed". Setting this to "Optimize for
Portability" should generate files where pages are independent so you
can extract/ reorder pages.

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


#933

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-05 09:28 +0100
Message-ID<4aidnQCuAfSzkNrNnZ2dnUVZ7tednZ2d@brightview.co.uk>
In reply to#930
On 05/09/2012 06:43, SaGS wrote:
> On Sep 4, 9:49 pm, Michael Kilpatrick <n...@mkilpatrick.cospam.uk>
> wrote:
>> ...
>> However, none of the files don't work with PSUtils.
>>
>> If, for example, I do either of these:
>>
>> psselect -p2 HP2pages.ps output.ps
>> psselect -p2 HP2pages-processed.ps output.ps
>>
>> then the output.ps file, when run through Adobe Acrobat, bombs out with
>> an error like this:
>>
>>    %%[ Error: undefined; OffendingCommand: AddT42Char ]%%
>> ...
>
> The "%%PageOrder: Special" comment found in these file specifies that
> pages are not independent so you cannot reorder/ extract/ etc pages
> from the file. The Windows PostScript driver generates this type of
> file if "Printing Preferences"/ "Advanced"/ "PostScript Output
> Option" (wording is for WinXP, may differ for other versions) for that
> printer is set to "Optimize for Speed". Setting this to "Optimize for
> Portability" should generate files where pages are independent so you
> can extract/ reorder pages.


Ugh, I'd tried to do that lots of times. I'm sure something keeps 
changing it back to "speed".

Anyway, trying it again on the HP universal PS driver, I can confirm 
that psselect works on that: so I can make a 2-page PDF using pages 2-3 
of a 3-page postscript file, for example. That is one step towards 
successfully separating the 2-page spreads for my requirement.

The resulting PS file correctly printed on my printer as two sheets of 
A4, no errors, and it also correctly went through Acrobat to PDF.

Next step: I tried using psnup to make a 2-page spread but I haven't got 
the hang of using it yet, so it produced half a sideways page instead! 
However, the results also correctly ran through Acrobat, so at least it 
likes what psnup does.

Does anyone know the correct command-line options for making 2 pages of 
A4 into a 2-page A3 spread?


Michael

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


#934

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-05 09:38 +0100
Message-ID<WKydnapr1KQ5ktrNnZ2dnUVZ8mGdnZ2d@brightview.co.uk>
In reply to#933
On 05/09/2012 09:28, Michael Kilpatrick wrote:

>
>
> Ugh, I'd tried to do that lots of times. I'm sure something keeps
> changing it back to "speed".
>
> Anyway, trying it again on the HP universal PS driver, I can confirm
> that psselect works on that: so I can make a 2-page PDF using pages 2-3
> of a 3-page postscript file, for example. That is one step towards
> successfully separating the 2-page spreads for my requirement.
>
> The resulting PS file correctly printed on my printer as two sheets of
> A4, no errors, and it also correctly went through Acrobat to PDF.
>


Hmm, I tried going back to the PS modifications I began with.

This time, on the 2-page spread, it was successfully printed (after 
using psselect -p2,3) but rather than a 2-page spread, both the pages 
were printed on top of each other in the left half of the A3 page, with 
the right half being blank!!!

???

Michael

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


#938

FromSaGS <sags5495@gmail.com>
Date2012-09-05 06:19 -0700
Message-ID<b2d3c9da-0850-4ae3-98fd-019cbec30518@googlegroups.com>
In reply to#934
On Wednesday, September 5, 2012 11:39:01 AM UTC+3, Michael Kilpatrick wrote:
> ...
> Hmm, I tried going back to the PS modifications I began with.
> 
> This time, on the 2-page spread, it was successfully printed (after 
> using psselect -p2,3) but rather than a 2-page spread, both the pages 
> were printed on top of each other in the left half of the A3 page, with 
> the right half being blank!!!
> ...

Now, you say that by inserting the small PostScript code fragment from your original post works OK for creating a PDF. By "works OK" I mean you get a PDF with an optional intial A4 page containing the 1st page of the document - if the total number of pages is odd -, followed by A3 pages with 2 doc pages each. In this case, why not produce and archive those PDFs, and not the PS?

Does the printer have 2 trays, to put A4 paper in one and A3 paper in another? I notice my oldish Adobe Reader (7.xx) has an option to "[x] Choose Paper Source by PDF page size". Once checked, and once the driver being correctly configured to know what paper size is in each tray, I expect you just print the PDF and get the correct size for each sheet of paper.

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


#935

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-05 10:07 +0100
Message-ID<P4idnbJd2pSqi9rNnZ2dnUVZ8nGdnZ2d@brightview.co.uk>
In reply to#933
On 05/09/2012 09:28, Michael Kilpatrick wrote:

>
> Next step: I tried using psnup to make a 2-page spread but I haven't got
> the hang of using it yet, so it produced half a sideways page instead!
> However, the results also correctly ran through Acrobat, so at least it
> likes what psnup does.


Flippin' heck, why doesn't psnup do anything sensible? All I can get it 
to do is create *2* pages, not one, first of which has the first of the 
two original pages in the right half, the second of which has the second 
of the two original pages on the left side!

Its description is "psnup - multiple pages per sheet", but it's not 
doing that.

Also, I can't get my printer to print a PDF (2 pages of A4) onto a 
2-page spread without it shrinking the pages a little and leaving a 
margin around the edge of the page. In other words, the two sides of A4 
are shrunk to about 90%-95%!

This whole business is quite ridiculous.

Michael

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


#937

FromSaGS <sags5495@gmail.com>
Date2012-09-05 06:09 -0700
Message-ID<332777cc-76a6-4961-8ce8-29454d02fb72@googlegroups.com>
In reply to#935
On Wednesday, September 5, 2012 12:07:03 PM UTC+3, Michael Kilpatrick wrote:
> ...
> Flippin' heck, why doesn't psnup do anything sensible? All I can get it 
> to do is create *2* pages, not one, first of which has the first of the 
> two original pages in the right half, the second of which has the second 
> of the two original pages on the left side!

psnup tries to nullify showpage calls for some pages (those that should not eject a sheet of paper) by redefining the operator with "/showpage {} def". But the driver-generated PS code makes o *copy* of the "showpage" operator somewhere inside the prologue and then uses that copy, so the redefinition has no effect.

To fix this, look for "/LH/showpage , d" (note: for me this sequence is split across 2 lines) and replace with "/LH {showpage} d" (/ -> {}, comma deleted). After this I got correctly 2 document pages on a single physical page.

> ...
> Also, I can't get my printer to print a PDF (2 pages of A4) onto a 
> 2-page spread without it shrinking the pages a little and leaving a 
> margin around the edge of the page. In other words, the two sides of A4 
> are shrunk to about 90%-95%!
> ...

Printers usually cannot print to the edge of the paper. The behavior you see must be the software you use to print the PDF fitting the 2 pages, in their entirety, to the *printable* area of the paper. Not sure how you can suppress this.

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


#939

FromMichael Kilpatrick <news@mkilpatrick.cospam.uk>
Date2012-09-05 15:16 +0100
Message-ID<zvKdnVBnhIhEw9rNnZ2dnUVZ8nSdnZ2d@brightview.co.uk>
In reply to#937
On 05/09/2012 14:09, SaGS wrote:
> On Wednesday, September 5, 2012 12:07:03 PM UTC+3, Michael Kilpatrick
> wrote:
>> ... Flippin' heck, why doesn't psnup do anything sensible? All I
>> can get it to do is create *2* pages, not one, first of which has
>> the first of the two original pages in the right half, the second
>> of which has the second of the two original pages on the left
>> side!
>
> psnup tries to nullify showpage calls for some pages (those that
> should not eject a sheet of paper) by redefining the operator with
> "/showpage {} def". But the driver-generated PS code makes o *copy*
> of the "showpage" operator somewhere inside the prologue and then
> uses that copy, so the redefinition has no effect.
>
> To fix this, look for "/LH/showpage , d" (note: for me this sequence
> is split across 2 lines) and replace with "/LH {showpage} d" (/ ->
> {}, comma deleted). After this I got correctly 2 document pages on a
> single physical page.

I did that (and I assume you mean the input file to psnup).

It didn't work. I haven't seen *any* proof yet that psnup does what it 
says it can.

Michael

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


#941

FromSaGS <sags5495@gmail.com>
Date2012-09-05 11:25 -0700
Message-ID<0d8f1db1-6e4c-421f-be67-f526ee521202@a11g2000yqb.googlegroups.com>
In reply to#939
On Sep 5, 5:16 pm, Michael Kilpatrick <n...@mkilpatrick.cospam.uk>
wrote:
> ...
> > To fix this, look for "/LH/showpage , d" (note: for me this sequence
> > is split across 2 lines) and replace with "/LH {showpage} d" (/ ->
> > {}, comma deleted).
> ...
> It didn't work. I haven't seen *any* proof yet that psnup does what it
> says it can.
> ...

Here is what I did:

(a) Created a 5-page document, each page containing a dashed border
1cm from the edge
    and the page #.

(b) Printed to file using the WinXP PostScript driver set to "Optimize
for portability".
    File named 5Pages.ps.

(c) Edited 5Pages.ps changing 2 characters as follows:

    -  /Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/
show , d/LH/showpage
    +  /Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/
show , d/LH{showpage
    -  , d/K/stroke , d/W/widthshow , d/R/rotate , d/L2? false/
languagelevel where{pop
    +  } d/K/stroke , d/W/widthshow , d/R/rotate , d/L2? false/
languagelevel where{pop

    New file named 5Pages-LH.ps.

    This edit is necessary because the way psnup redefines "showpage"
does not work
    with the way the PS driver emits code (as explained in a preceding
post).

(d) psnup -2 -pa3 -Pa4 5Pages-LH.ps 5Pages-LH-2up.ps

    psnup version: 1.17.

(e) gswin32c -sDEVICE=pdfwrite -sPAPERSIZE=a3 -o 5Pages-LH-2up.pdf
5Pages-LH-2up.ps

    The "-sPAPERSIZE=a3" sets an appropriate default page size. psnup
cancels attempts
    of the original PS to set the page size (so it won't set it to A4,
which is OK),
    but doesn't hardcode a [new] page size either and relies on the
page size being
    already set by other means (printer's front panel/ etc).

(f) Got a 3-page 2-up PDF with a page size of A3. Last page contains
only page 5
    of the original document, the right half of the A3 page being
blank.

I’ve put the resulting PDF online at <http://www.sendspace.com/file/
i92fmr> !!: TAKE CARE to click on "Click here to start download from
sendspace" that comes *after* the file name/ size, *NOT* the "Click
here to star the download" in the ad banner near the top of the page.
The link will expire in about a month from this post's date.

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


Page 1 of 2  [1] 2  Next page →

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


csiph-web