Академический Документы
Профессиональный Документы
Культура Документы
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
Tools:
1 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
2 0 obj
.. .. .. .. ..
endobj
The objects don't necessarily have to present themselves in numerical order and
it are possible to make reference to a future object, or not yet dened; this
results particularly useful and perhaps essential in some cases (for instance
when in the le it is necessary to point out the length of a text before the same
text has been inserted). When it is necessary to eect a reference to an object,
all it takes is pointing out his number and the revision followed by the letter R.
.. ..
/Parent 3 0 R
.. ..
In general, every makes whenever him necessary to use more times the same
object in more points of the document both it an image or a generic resource, to
optimize the use of memory and the speed of visualization, it is worthwhile to
create an object that contains the resource and to use references to this in all the
points in which it applies.
The sequences of data are contained among the key words stream and
endstream. This can contain any sequence of characters (also those not
printable) and they serve to describe a text, an image or other.
stream
//.. sequences of characters ..//
endstream
Structure of a PDF le
2 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
where the symbol % generally points out a line of comment and 1.3 it points out
whether to correctly read the contained information in the le is necessary
Acrobat Reader 4.0 (rather than 1.4 for which it is necessary Acrobat Reader
5.0, rather than 1.5 for Acrobat Reader 6.0 and so street).In the succession,
we will consider to always operate with formed compatible with Acrobat Reader
4.0 or with a specication % PDF-1.3.
The section BODY contains the objects that will be represented on the pages and
on which will detain subsequently there.
The section CROSS-REFERENCE TABLE is a tables that brings a reference to
every object present in the section BODY and his possible revision; particularly it
points out the position of the rst character of the denition of an object in
comparison to the beginning of the le and the number of revision to which it
refers.
xref
0 23
0000000019
0000000009
.. .. ..
0000000300
0000000384
65535 f
00000 n
00000 n
00000 n
The section TRAILER points out to the Reader how many objects are present in
the section BODY (/ Size), qual is the initial object (/ Root), what object contains
the general information of the document what author, title, dates of creation (/
Info), whether to nd the CROSS- REFERENCE TABLE and besides it marks the
end of the le (%% EOF).
trailer
<< /Size 7
/Root 1 0 R
/Info 2 0 R
>>
3 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
startxref
408
%%EOF
The object CATALOG represents the root of the whole document and has to be
that to which stings the reference /Root foresees in the section TRAILER.
1 0 obj
<< /Type /Catalog
/Pages 3 0 R
/Outlines 20 0 R
>>
endobj
In turn it contains a reference to the root of the pages, (/ Pages) and a reference
to the root of the tree that serves as index (/Outlines), that that, when it opens
a document with Acrobat Reader, it appears to the left usually some page and
it allows to quickly stir in the document, and that we for simplicity won't
analyze.
The object PAGES represents the root of the pages, it points out the general
number of the pages of the document (/Count) and it brings a reference to the
object that contains every page (/Kids).
3 0 obj
<< /Type /Pages
/Count 3
/Kids [4 0 R 8 0 R 10 0 R]
4 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
>>
endobj
The object PAGE brings a reference to his own root (/Parent), a list of the
resources used in the page (/Resources, will see subsequently what are), an
array with the dimensions of the anticipated format of press (/MediaBox) and
nally a reference to the object that contains the elements to represent on the
page (/Contents).
4 0 obj
<< /Type /Page
/Parent 3 0 R
/Resources << /ProcSet [/PDF /Text] >>
/MediaBox [0 0 595.2 842]
/Contents 5 0 R
>>
endobj
If in the document they are wanted to bring information related to the author, to
the application that has produced the le or the date of creation, the following
object can be used (watching out for the parentheses that belong to the syntax).
These information appear if from the Reader the ownerships of the document
are visualized.
2 0 obj
<< /Title (title)
/Author (author)
/Creator (application_creator)
/Producer (copyright)
/CreationDate (D:yyyymmddhhmmss+0100)
>>
The operators
For the denition of the contained elements in every page, the syntax of the
standard PDF foresees the use of some operating ones. Following some are
listed, only postponing to the texts in bibliography for a description more
detailed. Particularly, keep mind that the graphic operators describe only a run
(path) that will be traced only physically when a special operator will be used
and that the components of color go from 0 to 1 and not from 0 to 255.
5 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
Operator
Description
XYm
XYl
Xw
Close a path
End a path
Fill a path
r g b RG
r g b rg
gray G
gray g
x1 y1 x2 y2 x3 y3 c
x y width height re
W 0 0 H X Y cm
BT
ET
space Tc
space Tw
scale Tz
space TL
X Y Td
fontname size Tf
string Tj
Draw a text
/name Do
The paths
The paths represent some invisible layouts, that become visible only following an
6 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
To write the classic Hello World to the position of coordinates (100,400) with
the font dened in precedence named Fn1, it will be enough to insert in an
object the sequence
\\ % Write Hello World with Arial Bold Italic 24 pts
BT
/Fn1 24 Tf
100 400 Td
(Hello World) Tj
ET
7 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
To notice as to the place of the length of the stream a reference has been used
to an object (13 0) that it contains (only) the value 150.
If we want to visualize the image with the left inferior angle in the point (100,
8 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
80), with a horizontal dimension 200 and a vertical of 300, it will be enough to
insert the sequence
q
200 0 0 300 100 80 cm
/Img1 Do
Q
%
%
%
%
%
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
As we have seen, the principal elements of a document PDF are the objects. We
have the necessity therefore to build a mechanism that allows us to manage the
writing of the object and contextually the management of the section CROSSREFERENCE TABLE, in which, as already says, a reference must be written to
the created object. It doesn't need to forget that there are some objects that in a
logical order they would go before others, for example the root of the pages
/Pages, even if they contain references, to the pages, that are known only after
all the objects have been built. To resolve the underlined problems, is thought
about using a structure and such a numeration of the objects that the references
were known previously. This way doing, the document is built in such way that
the object /Pages, and in similar way the others, have always the same number
of reference, even if is physically built after the others. In other words, the
structure type of the produced document is the following
1 0 obj Info
2 0 obj Catalog
3 0 obj Encoding
6 0 obj (available)
7 0 obj (available)
.. .. .. ..
.. .. .. .. ..
n-1 0 obj (available)
n 0 obj (available)
4 0 obj Pages
5 0 obj Resource
by this way the reference to the intermediary objects, for instance the /Parent
foresees in every object /Page, is always known, while the other ones can be
built to hand hand that the objects are created and inserted at the end in the
denition of the objects 4 and 5.
10 of 11
03/06/2015 02:31 AM
http://www.luigimicco.altervista.org/doku.php/en/doc/pdf_...
the object 5 0 precise that the document uses two fonts (Fnt1 and Fnt2)
respectively represented by the objects 6 0 and 7 0, an object image Img1
(object 8 0) and an object form (object 9 0). Besides it points out that inside the
document there are some standard operators (/PDF), of the objects type text
(/Text), of the images in staircase of grey (/ImageB), of the color images RGB
(/ImageC) and of the images to indexed palette (/ImageI).
Vector graphics
Before using the operating type line, arc or other, to always remember
himself/herself/themselves settare the point of beginning of the layout with the
operative MoveTo. In the case of layouts composed from more elementary lines,
recommend him to use only on the last line the options of sketch, closing or
lling.
en/doc/pdf_structure.txt Last modied: 19/03/2013 09:58 (external edit)
11 of 11
03/06/2015 02:31 AM