ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* texexec: can it crop?
@ 2000-11-22 13:14 Christopher Tipper
  2000-11-22 15:47 ` Hans Hagen
  2000-11-22 21:30 ` Johannes H?sing
  0 siblings, 2 replies; 7+ messages in thread
From: Christopher Tipper @ 2000-11-22 13:14 UTC (permalink / raw)


Hi all,

I am interested in knowing whether anyone has studied the problem of slicing up pages. This may not be so much context stuff, but texexec has some nice pdf operators, and I wondered if it could crop pages as well as rearrange them.

Technical problem: postscript file of slides in a 2x2 format. I want to chop each page into four pieces and put each slide on successive pages. the pstops utility is impossible to figure from the documentation,and it would be so much easier to convert to pdf and then 'operate'.

Christopher
---------------------------------------------------------------------
   Nil Desperandum Illegitimi 
   -- Don't let the bastards get you down (~Ovid)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-22 13:14 texexec: can it crop? Christopher Tipper
@ 2000-11-22 15:47 ` Hans Hagen
  2000-11-22 18:40   ` Christopher Tipper
  2000-11-22 21:30 ` Johannes H?sing
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2000-11-22 15:47 UTC (permalink / raw)
  Cc: ConTeXT Mailing List

At 01:14 PM 11/22/00 -0000, Christopher Tipper wrote:
>Hi all,
>
>I am interested in knowing whether anyone has studied the problem of
slicing up pages. This may not be so much context stuff, but texexec has
some nice pdf operators, and I wondered if it could crop pages as well as
rearrange them.
>
>Technical problem: postscript file of slides in a 2x2 format. I want to
chop each page into four pieces and put each slide on successive pages. the
pstops utility is impossible to figure from the documentation,and it would
be so much easier to convert to pdf and then 'operate'.

Incredible what manipulations one wants. Fortunately this is rather trivial
to implement. [a more efficient method is to embed it in the output
routine, but that can make documents faulty. 

% interface=en output=pdftex

\unprotect

\def\slicepages%
  {\dodoubleempty\doslicepages}

\def\doslicepages[#1][#2]%
  {\bgroup
   \getfiguredimensions[#1]
   \getparameters[\??ip][\c!n=1,#2]
   \definepapersize
     [\s!dummy][\c!hoogte=\figureheight,\c!breedte=\figurewidth]
   \setuppapersize
     [\s!dummy][\s!dummy]
   \setuplayout
     [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
      \c!hoogte=\v!midden,\c!breedte=\v!midden,
      \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
   \dorecurse{\noffigurepages}
     {\let\pslice=\recurselevel
      \dorecurse{\@@ipn}
        {\let\xslice\recurselevel
         \dorecurse{\@@ipn}
           {\let\yslice\recurselevel
            \clip
              [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
              {\schaal
                 [\c!schaal=\@@ipn000]
                 {\externalfigure[#1][\c!pagina=\pslice]}}
            \pagina}}}
   \egroup}

\protect 

\starttext 

%\dorecurse{20}{\input tufte \par} 

\slicepages[slice1.pdf][n=3] 

\stoptext 

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-22 15:47 ` Hans Hagen
@ 2000-11-22 18:40   ` Christopher Tipper
  2000-11-22 23:26     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Tipper @ 2000-11-22 18:40 UTC (permalink / raw)
  Cc: ConTeXT Mailing List

> Incredible what manipulations one wants. Fortunately this is rather trivial
> to implement. [a more efficient method is to embed it in the output
> routine, but that can make documents faulty. 

\slicepages[file.pdf][n=2] does 90% of the job.

without knowing how tex macros operate I suspect the problem with my output stems from the fact that the origin is bottom-left rather than top-left.

So if the slides are arranged like so

1  2
3  4

my output then becomes

3 4 1 2 etc. etc. i.e. starting from bottom-left. Maybe a fix is too complicated?

the second problem may also be a factor of how pdf's are designed. Basically the pages come out rotated 90 degrees clockwise. When I do

   \setuppapersize
     [\s!dummy,90][\s!dummy,landscape]

doesn't quite fix it, as Acrobat doesn't forget the page height, so one ends up with the graphic the right way up on a square bounding box.

Problems, problems... :-)

Christopher


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-22 13:14 texexec: can it crop? Christopher Tipper
  2000-11-22 15:47 ` Hans Hagen
@ 2000-11-22 21:30 ` Johannes H?sing
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes H?sing @ 2000-11-22 21:30 UTC (permalink / raw)


On Wed, Nov 22, 2000 at 01:14:20PM -0000, Christopher Tipper wrote:
[...]  > 

> the pstops utility is impossible to figure from the documentation,

Don't do it unjust. I figured it out from the manpage and once you 
understand it it works black magic.

You want something alog the lines of 

pstops '4:0@.5(0,14.85cm)+1@.5(10.5cm,14.85cm)+2@.5(0,0)+3@.5(10.5cm,0)' infile.ps outfile.ps

Looks scary? It is very shorthand but really flexible. It tells your
ghostscript engine to process four pages at once ("4:"), numbered 0, 1, 2, 
and 3. The placements of these single pages on the new page would be 
separated by plus signs. A single placement tells ghostscript something about 
the size ("@.5", that means, half the size), the orientation (left out which
defaults to upright, but [L]eft, [R]ight and [U]pside down is possible too), 
and the offset (in round parenthesis with Postscript points as the default
unit). If you wanted to have spread the output on multiple pages you'd
have to separate the pages by commas.

Try to work out what each single entry means and you'll be able to perform
many useful things.

Greetings 

Johannes
-- 
Johannes Hüsing <hannes@ruhrau.de> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-22 18:40   ` Christopher Tipper
@ 2000-11-22 23:26     ` Hans Hagen
  2000-11-23 11:33       ` Christopher Tipper
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2000-11-22 23:26 UTC (permalink / raw)
  Cc: ConTeXT Mailing List

At 06:40 PM 11/22/00 -0000, Christopher Tipper wrote:
>> Incredible what manipulations one wants. Fortunately this is rather trivial
>> to implement. [a more efficient method is to embed it in the output
>> routine, but that can make documents faulty. 
>
>\slicepages[file.pdf][n=2] does 90% of the job.
>
>without knowing how tex macros operate I suspect the problem with my
output stems from the fact that the origin is bottom-left rather than
top-left.
>
>So if the slides are arranged like so
>
>1  2
>3  4
>
>my output then becomes
>
>3 4 1 2 etc. etc. i.e. starting from bottom-left. Maybe a fix is too
complicated?

You need to be more specific since i dunno why you need this. A different
order is not that undoable, kind of 

\dorecurse{2} -> \dostepwiserecurse{2}{1}{-1}

>the second problem may also be a factor of how pdf's are designed.
Basically the pages come out rotated 90 degrees clockwise. When I do
>
>   \setuppapersize
>     [\s!dummy,90][\s!dummy,landscape]
>
>doesn't quite fix it, as Acrobat doesn't forget the page height, so one
ends up with the graphic the right way up on a square bounding box.

Rotation is bit of a problem indeed, changing page size isn't. 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-22 23:26     ` Hans Hagen
@ 2000-11-23 11:33       ` Christopher Tipper
  2000-11-23 11:35         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Tipper @ 2000-11-23 11:33 UTC (permalink / raw)
  Cc: ConTeXT Mailing List

> >> Incredible what manipulations one wants. Fortunately this is rather trivial
> >> to implement. [a more efficient method is to embed it in the output
> >> routine, but that can make documents faulty. 
> >
> >\slicepages[file.pdf][n=2] does 90% of the job.
> >
> >without knowing how tex macros operate I suspect the problem with my
> output stems from the fact that the origin is bottom-left rather than
> top-left.
> >
> >So if the slides are arranged like so
> >
> >1  2
> >3  4
> >
> >my output then becomes
> >
> >3 4 1 2 etc. etc. i.e. starting from bottom-left. Maybe a fix is too
> complicated?

The following hack works:

   \dorecurse{\noffigurepages}
     {\let\pslice=\recurselevel
      \dostepwiserecurse{\@@ipn}{1}{-1}            %this changed
        {\let\xslice\recurselevel
         \dorecurse{\@@ipn}
           {\let\yslice\recurselevel
            \clip
              [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
              {\schaal
                 [\c!schaal=\@@ipn000]
                 {\externalfigure[#1][\c!pagina=\pslice]}}
            \pagina}}}
   \egroup}

I don't know what impact for n=3, n=4, n=5 etc. is.

Christopher


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: texexec: can it crop?
  2000-11-23 11:33       ` Christopher Tipper
@ 2000-11-23 11:35         ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2000-11-23 11:35 UTC (permalink / raw)
  Cc: ConTeXT Mailing List

At 11:33 AM 11/23/00 -0000, Christopher Tipper wrote:
>> >> to implement. [a more efficient method is to embed it in the output
>> >> routine, but that can make documents faulty. 
>> >>> >> Incredible what manipulations one wants. Fortunately this is
rather trivial

>> >\slicepages[file.pdf][n=2] does 90% of the job.
>> >
>> >without knowing how tex macros operate I suspect the problem with my
>> output stems from the fact that the origin is bottom-left rather than
>> top-left.
>> >
>> >So if the slides are arranged like so
>> >
>> >1  2
>> >3  4
>> >
>> >my output then becomes
>> >
>> >3 4 1 2 etc. etc. i.e. starting from bottom-left. Maybe a fix is too
>> complicated?
>
>The following hack works:
>
>   \dorecurse{\noffigurepages}
>     {\let\pslice=\recurselevel
>      \dostepwiserecurse{\@@ipn}{1}{-1}            %this changed
>        {\let\xslice\recurselevel
>         \dorecurse{\@@ipn}
>           {\let\yslice\recurselevel
>            \clip
>              [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
>              {\schaal
>                 [\c!schaal=\@@ipn000]
>                 {\externalfigure[#1][\c!pagina=\pslice]}}
>            \pagina}}}
>   \egroup}
>
>I don't know what impact for n=3, n=4, n=5 etc. is.

Well, you can test it. Works the same 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-11-23 11:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-22 13:14 texexec: can it crop? Christopher Tipper
2000-11-22 15:47 ` Hans Hagen
2000-11-22 18:40   ` Christopher Tipper
2000-11-22 23:26     ` Hans Hagen
2000-11-23 11:33       ` Christopher Tipper
2000-11-23 11:35         ` Hans Hagen
2000-11-22 21:30 ` Johannes H?sing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).