�
J�g?/ � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z m
Z
d� Z d%d
�Zd� Z
d� Zd&d�Z G d� de� � Z G d� de� � Z G d� d� � Z G d� de� � Zd&d�Zd� Z G d� de� � Z G d� d� � Z G d� d e� � Z G d!� d"e� � Z G d#� d$e� � ZdS )'a
Classes & functions that represent core elements of the PDF syntax
Most of what happens in a PDF happens in objects, which are formatted like so:
```
3 0 obj
<</Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R>>
endobj
```
The first line says that this is the third object in the structure of the document.
There are 8 kinds of objects (Adobe Reference, 51):
* Boolean values
* Integer and real numbers
* Strings
* Names
* Arrays
* Dictionaries
* Streams
* The null object
The `<<` in the second line and the `>>` in the line preceding `endobj` denote
that it is a dictionary object. Dictionaries map Names to other objects.
Names are the strings preceded by `/`, valid Names do not have to start with a
capital letter, they can be any ascii characters, # and two characters can
escape non-printable ascii characters, described on page 57.
`3 0 obj` means what follows here is the third object, but the name Type
(represented here by `/Type`) is mapped to an indirect object reference:
`0 obj` vs `0 R`.
The structure of this data, in python/dict form, is thus:
```
third_obj = {
'/Type': '/Page'),
'/Parent': iobj_ref(1),
'/Resources': iobj_ref(2),
'/Contents': iobj_ref(4),
}
```
Content streams are of the form:
```
4 0 obj
<</Filter /ASCIIHexDecode /Length 22>>
stream
68656c6c6f20776f726c64
endstream
endobj
```
The contents of this module are internal to fpdf2, and not part of the public API.
They may change at any time without prior warning or any deprecation period,
in non-backward-compatible ways.
� N)�ABC)�hexlify)�BOM_UTF16_BE)�datetime�timezonec �>