Module eg_pdf_lib

ErlGuten PDF library routines.

Description

ErlGuten PDF library routines

Data Types

array()

array() = {array, [pdftype()]}

date()

date() = {date, Date::calendar:datetime() | calendar:date()}

dict()

dict() = {dict, [{string(), pdftype()}]}

name()

name() = {name, string()}

objkey()

objkey() = {obj, Ref::integer(), Gen::integer()}

pdfobject()

pdfobject() = {objkey(), pdftype()}

pdfobjects()

pdfobjects() = [pdfobject()]

pdfstring()

pdfstring() = {string, string()} | {hexstring, string()}

pdftype()

pdftype() = dict() | stream() | ptr() | name() | array() | pdfstring() | boolean() | date() | number() | null

ptr()

ptr() = {ptr, Ref::integer(), Gen::integer()}

stream()

stream() = {stream, dict(), iolist() | binary()} | {stream, iolist() | binary()}

Function Index

add_object/2Makes a new object from PDFItem, and adds it to Objects .
code128/1
delete_object/2deletes a PDF object.
draw_box/6
export/2Make a pdf document ready for export to file or any other media (network etc.).
find_in_dict/2Finds a item in a PDF dictionary with Key.
get_next_ref/1returns next available Reference count.
get_objects_of_type/2Returns a list of objects with dictionary key "Type" = Type PDF object types are ("Pages", "Page", "Font", etc).
get_ref/1
is_pdf_object_type/2Returns true if the object has the type name Type, otherwise false.
make_object/2Returns a PDF Object with Reference number Ref and PDFItem.
make_object_key/1Returns an Object Key with Reference number Ref.
moveAndShow/4
moveAndShow/5
moveAndShowRight/5Str is drawn to the left of X (X is the _right_ alignment side of the Str text box).
moveAndShowRot/5
pdf_item/1Returns the PDFItem for the Object.
pdf_item/2Returns the PDFItem for the Object corresponding to Key.
pdf_object_dict_item/2Returns the value corresponding to Key from a PDF Objects dictionary.
search_object/2Find PDFItem related object reference.
serialise/1Returns a serialised object as a deep list of strings For example,

 
  {obj,1, 0,
   {stream,
     {dict,
       {"Type",{name,"XObject"}},
       {"Subtype",{name,"Image"}},
       {"Width", 997},
       {"Height", 744},
       {"Filter",{name,"FlateDecode"},
       {"DecodeParms", {dict,[{"Predictor", 15},
                       {"Colors", 3},
                       {"BitsPerComponent", 8},
                       {"Columns", 997}]}},
       {"ColorSpace",{name,"DeviceRGB}},
                       {"BitsPerComponent", 8},
                       {"Columns", 997}}
  }}}
.
serialise2bin/1Returns a serialised object as a binary.
showGrid/2showGrid(PDF, pagesize atom from eg_pdf.erl) adds a grid to the current page.
store_in_dict/2Stores a new item in a PDF dictionary, replacing the old one if it exists.
store_object/2Returns a copy of Objects1 with Objects added or, if the object's reference already is present, replacing the old object.

Function Details

add_object/2

add_object(PDFItem::pdftype(), Objects::pdfobjects()) -> {Ref::integer(), pdfobjects()}

Makes a new object from PDFItem, and adds it to Objects . Returns the Reference number for the added object and the new Object list

code128/1

code128(String0::string()) -> string()

delete_object/2

delete_object(Key::objkey() | ptr() | integer(), Objects::pdfobjects()) -> pdfobjects()

deletes a PDF object. One shall not be able to remove items from the list, since the new Key generation is based on the Objects list length, so delete is implemented just to set an object to null

draw_box/6

draw_box(PDF, X, Y, Measure, Lines, MaxRows) -> any()

export/2

export(InfoRef::integer(), Objects::pdfobjects()) -> binary()

Make a pdf document ready for export to file or any other media (network etc.).

find_in_dict/2

find_in_dict(Key::string(), Dict::dict()) -> pdftype() | undefined

Finds a item in a PDF dictionary with Key

get_next_ref/1

get_next_ref(Objects::pdfobjects()) -> Ref::integer()

returns next available Reference count

get_objects_of_type/2

get_objects_of_type(Type::string(), Objects::pdfobjects()) -> pdfobjects()

Returns a list of objects with dictionary key "Type" = Type PDF object types are ("Pages", "Page", "Font", etc).

get_ref/1

get_ref(Object::pdfobject()) -> integer()

is_pdf_object_type/2

is_pdf_object_type(Type::string(), Object::pdfobject()) -> boolean()

Returns true if the object has the type name Type, otherwise false. PDF object types are ("Pages", "Page", "Font", etc).

make_object/2

make_object(Ref::integer(), PDFItem::pdftype()) -> pdfobject()

Returns a PDF Object with Reference number Ref and PDFItem

make_object_key/1

make_object_key(Ref::integer()) -> objkey()

Returns an Object Key with Reference number Ref

moveAndShow/4

moveAndShow(PDF::eg_pdf:pdf_server_pid(), X::number(), Y::number(), Str::string()) -> ok

moveAndShow/5

moveAndShow(PDF::eg_pdf:pdf_server_pid(), X::number(), Y::number(), Str::string(), Scale::number()) -> ok

moveAndShowRight/5

moveAndShowRight(PDF, FontSize, X, Y, Str) -> any()

Str is drawn to the left of X (X is the _right_ alignment side of the Str text box)

moveAndShowRot/5

moveAndShowRot(PDF::eg_pdf:pdf_server_pid(), X::number(), Y::number(), Str::string(), Rot::number()) -> ok

pdf_item/1

pdf_item(Object::pdfobject()) -> pdftype()

Returns the PDFItem for the Object.

pdf_item/2

pdf_item(Key::objkey(), Objects::pdfobjects()) -> pdftype()

Returns the PDFItem for the Object corresponding to Key. If no object is found and exception is generated.

pdf_object_dict_item/2

pdf_object_dict_item(Key::string(), Object::pdfobject()) -> pdftype() | undefined | not_dict

Returns the value corresponding to Key from a PDF Objects dictionary. ("Pages", "Page", "Font", etc). If the Key is missing undefined is returned If the Object is not a dictionary not_dict is returned

search_object/2

search_object(Key::objkey() | ptr() | integer(), Objects::pdfobjects()) -> {value, pdfobject()} | false

Find PDFItem related object reference. All pdftypes are {Key, Value} tuples where the Key indicates the type.

serialise/1

serialise(Object::pdfobject() | pdftype()) -> iolist()

Returns a serialised object as a deep list of strings For example,


 
  {obj,1, 0,
   {stream,
     {dict,
       {"Type",{name,"XObject"}},
       {"Subtype",{name,"Image"}},
       {"Width", 997},
       {"Height", 744},
       {"Filter",{name,"FlateDecode"},
       {"DecodeParms", {dict,[{"Predictor", 15},
                       {"Colors", 3},
                       {"BitsPerComponent", 8},
                       {"Columns", 997}]}},
       {"ColorSpace",{name,"DeviceRGB}},
                       {"BitsPerComponent", 8},
                       {"Columns", 997}}
  }}}

becomes


  1 0 obj
  <<
  /Type  /XObject
  /Subtype  /Image
  /Width  997
  /Height  744
  /Filter  /FlateDecode
  /DecodeParms <<
  /Predictor  15
  /Colors  3
  /BitsPerComponent  8
  /Columns  997
  >>
  /ColorSpace  /DeviceRGB
  /BitsPerComponent  8
  /Length  1412674
  >>
  

serialise2bin/1

serialise2bin(L::pdfobject() | [pdfobject()]) -> [binary()]

Returns a serialised object as a binary

showGrid/2

showGrid(PDF, Paper) -> any()

showGrid(PDF, pagesize atom from eg_pdf.erl) adds a grid to the current page

store_in_dict/2

store_in_dict(A::{Key::string(), Value::pdftype()}, Dict::dict()) -> dict()

Stores a new item in a PDF dictionary, replacing the old one if it exists.

store_object/2

store_object(Objects::pdfobject() | pdfobjects(), Objects1::pdfobjects()) -> pdfobjects()

Returns a copy of Objects1 with Objects added or, if the object's reference already is present, replacing the old object.


Generated by EDoc