For Programmers: Free Programming Magazines  


Home > Archive > PostScript > February 2005 > Calculating page size









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Calculating page size
Geoffrey Washburn

2005-02-20, 4:02 am

Is anyone aware of a simple tool that will calculate the page size of a
PostScript document? In particular, I'd like a command line tool that
will spit out "a4", "letter", etc. If such a thing does not exist, is
there a simple way to extract the information from the document without
having to do significant amounts of interpertation? The PS Reference
Manual describes a PageSize operator, but a survey of some of my
PostScript documents indicates that it is not commonly used. The
bounding box information included in the header of most files does not
seem to be useful for determining the size either. Any help would be
appreciated. Thanks!

Rod Dorman

2005-02-20, 4:02 am

In article <1108864484.196844.55330@g14g2000cwa.googlegroups.com>,
Geoffrey Washburn <washburn@acm.org> wrote:
>Is anyone aware of a simple tool that will calculate the page size of a
>PostScript document?


The PostScript model has infinite dimensions (although reality steps
in with architectural limits) which makes for a really big piece of
paper :-)

>... The bounding box information included in the header of most
>files does not seem to be useful for determining the size either.


But it does tell you the smallest size paper that could be used. If
you're looking for a 'standard' size pick the smallest one that it
will fit on.

If its DSC complient it may have a %%DocumentMedia: comment which
would tell you what the creator of the document intended it to be
printed on.

--
-- Rod --
rodd(at)polylogics(dot)com
Rob Daykin

2005-02-20, 8:57 am

Page size can be assumed in many cases because a RIP has a default page
size. If you know the target printer, or even can assume a4 in Europe
or letter in the US, then the page size is frequently omitted. As for
EPSF, the BoundingBox may not be the absolute bounds of the painting
operators, it is the absolute limit of what should be used. This is
often enforced by a clipping path. A page size is not applicable to
EPSF as the concept of a page is not applicable. The BoundingBox may be
larger than the painted area as well.
The only real way to do this is to RIP the files using an interpreter
which honours setpagedevice. Have you tried distiller creating ASCII
output? Then read the resulting page size from the PDF.

regards
Rob Daykin
software developer
Pindar Set
Helge Blischke

2005-02-20, 3:57 pm

Geoffrey Washburn wrote:
>
> Is anyone aware of a simple tool that will calculate the page size of a
> PostScript document? In particular, I'd like a command line tool that
> will spit out "a4", "letter", etc. If such a thing does not exist, is
> there a simple way to extract the information from the document without
> having to do significant amounts of interpertation? The PS Reference
> Manual describes a PageSize operator, but a survey of some of my
> PostScript documents indicates that it is not commonly used. The
> bounding box information included in the header of most files does not
> seem to be useful for determining the size either. Any help would be
> appreciated. Thanks!


Use Ghostscript's bbox device. It tells you the bounding box for each
page; interpreting that output then it's easy to hack a script that will
determine which standard media size would be suitable.

Helge

--
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de
tel: +49 30 75301-360
Aandi Inston

2005-02-20, 3:57 pm

"Geoffrey Washburn" <washburn@acm.org> wrote:

>Is anyone aware of a simple tool that will calculate the page size of a
>PostScript document? In particular, I'd like a command line tool that
>will spit out "a4", "letter", etc. If such a thing does not exist, is
>there a simple way to extract the information from the document without
>having to do significant amounts of interpertation?


If the PostScript file happens to be DSC compliant, it might (or might
not) contain DSC comments giving this information.

>The PS Reference
>Manual describes a PageSize operator


No, the operator is setpagedevice; this is one of the parameters that
might be found in its operand dictionary. Or the PostScript might use
one of the device dependent operators.

To get information on a PostScript file, in general, requires actually
interpreting the file.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com