baseline PDF
PDF backend (baseline-pdf)
| Name | Returns | Parameters | Description |
|---|---|---|---|
baselinepdf.new() |
PDF writer | string (filename) | Create a new PDF backend object based on the file given with filename. The file is created if it does not exist. If it exists, it is overwritten. |
PDF writer
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
default_page_height |
R/W | number | The default height for new pages. |
default_page_width |
R/W | number | The default width for new pages. |
default_offset_x |
R/W | number | The default horizontal offset for new pages. |
default_offset_y |
R/W | number | The default vertical offset for new |
size |
R | The number of bytes in the PDF document. |
Methods
| Name | Returns | Parameters | Description |
|---|---|---|---|
new_face() |
Face object | string (name) | Create a font instance from the font path with the given name. |
add_page() |
Page object | Stream object, [object number] | Create a new blank PDF page object. |
load_image_file() |
Image file | string (filename), [page integer], [box string] | Load an image file from the given filename. page defaults to 1 and box defaults to “/MediaBox” |
finish() |
none | Finalize and write the PDF document to disk. | |
new_object() |
Generic object | none | Create a new generic PDF object. |
new_object_with_number() |
Generic object | object number or integer | Create a new generic PDF object with the given object number. |
next_object() |
Object number | none | Get the next available PDF object number. |
print() |
string | Print a message to the standard output. | |
printf() |
string | Print a formatted message to the standard output. | |
println() |
string | Print a message with newline to the standard output. |
Page object
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
dict |
R/W | Map | Additional entries to the page dictionary. |
faces |
R/W | List | The list of font faces used on the page. |
height |
R/W | number | The height of the page. |
images |
R/W | List | The list of image files used on the page. |
object_number |
R/W | object number or integer | The object number of the page. |
offset_x |
R/W | number | The horizontal offset of the page. |
offset_y |
R/W | number | The vertical offset of the page. |
width |
R/W | number | The width of the page. |
Generic object
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
array |
R/W | List | The array data of the object. |
data |
R/W | Buffer | The stream data of the object. |
dict |
R/W | Map | The dictionary of the object. |
force_stream |
R/W | boolean | If true, always write as stream. |
object_number |
R/W | object number or integer | The object number of the object. |
raw |
R/W | boolean | If true, data holds raw content. |
Methods
| Name | Returns | Parameters | Description |
|---|---|---|---|
save() |
none | Save the object data to the PDF file. | |
set_compression() |
int | If the parameter is > 0, enable stream compression. |
Object number type
An object number represents a PDF object number.
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
ref |
R | The object reference as string (e.g. 1 0 R). |
Image objects
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
internal_name |
R | The internal name of the image object. | |
page_number |
R | The page number the image belongs to. |
Methods
| Name | Returns | Parameters | Description |
|---|---|---|---|
close() |
none | Close the image file and free memory. | |
get_pdf_box_dimensions() |
List | page number integer, box name | Get the PDF box dimensions of image. |
Face object
Attributes
| Field | R/W | Parameters | Description |
|---|---|---|---|
face_id |
R | The ID of the font face. | |
filename |
R | The filename of the font face. | |
internal_name |
R | The internal name of the font face. | |
postscript_name |
R | The PostScript name of the font face. | |
units_per_em |
R | The units per EM of the font face. |
Methods
| Name | Returns | Parameters | Description |
|---|---|---|---|
codepoint() |
integer | rune | Get the internal code point for the given rune. |
codepoints() |
List | list of runes | Get the internal code points for the given runes. |
register_codepoint() |
codepoint integer | Register a codepoint as used on the page. | |
register_codepoints() |
list of codepoints | Register multiple codepoints as used on the page. |