Where is the definition or documentation of PDF "default user spaceunits"?

T

Ted Byers

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
 
B

Brian Helterline

Ted said:
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.

default units are 72dpi. I've never changed them, just used them.
 
L

luser-ex-troll

default units are 72dpi.  I've never changed them, just used them.

Adobe offers the PDF manual for download.
Or the postscript manual will give much of the same information
(as far as the imaging model is concerned).

Apropos FYI, the unit is just shy of a "standard" printer's
point (72.27). So a 10pt font from a laserprinter is ever-so-
slightly smaller than the 10pt letterpress fontface in your
old Moby Dick.

lxt
 
R

RedGrittyBrick

T

Ted Byers

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
 
L

luser-ex-troll

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top