Re: Where is the definition or documentation of PDF "default user space units"?
- From: luser-ex-troll <mijoryx@xxxxxxxxx>
- Date: Wed, 11 Mar 2009 23:29:38 -0700 (PDT)
On Mar 11, 10:35 am, Ted Byers <r.ted.by...@xxxxxxxxx> wrote:
On Mar 10, 2:54 pm, Ted Byers <r.ted.by...@xxxxxxxxx> wrote:
Searching through the documentation for the PDF Perl packages'
documentation, I found very terse mention of "default user space
units", but I have yet to find what the default is, or how I can
change it (or at least make a call that says the coordinates provided
are in mm). To date, all my perl scripts that make PDF files use
coordinates determined by trial and error, but I want to change this
so I can just use coordinates in mm, or cm, and forget the tedium of
rerunning the script seemingly countless times to get the position of
text just right.
Thanks
Ted
Thanks guys.
Knowing the default units are points is a start, providing familiar
ground. It makes writing functions to convert from any other unit of
length to points trivial. I am quite used to writing code in a number
of languages to support real time animation, and to write code
generated graphics to a variety of output devices including printers:
all of which required explicit transformations from real world
coordinates to device coordinates. However, the question is more
about use of PDF::API2, and related packages, than it is about the PDF
specification itself.
Depending on where the author lived and worked, his "default user
space units" could well have been inches, feet, millimeters, or
centimeters. What was written in the documentation I referred to does
not make even that clear.
A colleague told me yesterday that the PHP PDF package he uses
supports providing coordinates in millimeters, and naturally I looked
into the Perl packages I use to see if they provide comparable
functionality. The problem I encountered is one of salient
information apparently not being provided in the documentation of
functions and packages provided to create and edit PDF files. If they
don't I can easily create it myself. But as you can understand, I
would want to avoid recreating the wheel, and so would use the
packages' functions if they do what I require.
Thanks again,
Ted
If you're using a toolchain that goes through Postscript,
you can scale the coordinate system to inches
72 72 scale
or millimeters
72 2.54 div 28.3465 scale
or
28.3465 dup scale
I don't know the particulars of the various pdf
generators, but this is a fundamental capability
of the image model, hard-won in the desktop wars
of the eighties.
N.B. Transformations are often reset for each page.
For multiple pages, you'll have to arrange to
rescale on each one.
lxt
.
- References:
- Prev by Date: Re: Regexp for multiple consecutive capitalized words
- Next by Date: FAQ 8.50 What is socket.ph and where do I get it?
- Previous by thread: Re: Where is the definition or documentation of PDF "default user space units"?
- Next by thread: FAQ 8.48 How do I add the directory my program lives in to the module/library search path?
- Index(es):
Relevant Pages
|