global pdfe
😱 Types incomplete or incorrect? 🙏 Please contribute!
methods
pdfe.open
function pdfe.open(filename: string) -> doc PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}
filename
- File name.
@return doc
- Pdfe document.
Reference:
- Corresponding C source code: lpdfelib.c#L834-L851
😱 Types incomplete or incorrect? 🙏 Please contribute!
Open a pdf file.
pdfe.new
function pdfe.new(
contents: string,
size: integer
) -> __Reference PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}
contents
- A string containing a complete pdf file.
@param size
- Size of contents in bytes.
@return __Reference
- :__
- Corresponding C source code: lpdfelib.c#L853-L917
😱 Types incomplete or incorrect? 🙏 Please contribute!
Open a pseudo (in-memory) pdf file.
pdfe.getstatus
function pdfe.getstatus(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> status integer
doc
- Pdfe document.
@return status
- Encryption status.
- -2 pdfe.unencrypt()
failed
- 0 pdfe.unencrypt()
Reference:
- Corresponding C source code: lpdfelib.c#L1031-L1038
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the encryption status of a pdfe document.
pdfe.close
function pdfe.close(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
})
doc
- Pdfe document.
Reference:
- Corresponding C source code: lpdfelib.c#L945-L948
😱 Types incomplete or incorrect? 🙏 Please contribute!
Close a pdfe document.
pdfe.unencrypt
function pdfe.unencrypt(
doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
},
userpassword: string?,
ownerpassword: string?
)
doc
- Pdfe document.
@param userpassword
- User password.
@param ownerpassword
- Owner password.
Reference:
- Corresponding C source code: lpdfelib.c#L963-L991
😱 Types incomplete or incorrect? 🙏 Please contribute!
Unencrypt a pdfe document.
pdfe.getsize
function pdfe.getsize(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> size integer
doc
- Pdfe document.
@return size
- Size of pdf document is bytes.
Reference:
- Corresponding C source code: lpdfelib.c#L1008-L1015
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the size of a pdfe document in bytes.
pdfe.getversion
function pdfe.getversion(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
})
-> major integer
-> minor integer
@return major
- major version number
@return minor
- minor version number
Reference:
- Corresponding C source code: lpdfelib.c#L1017-L1029
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the version number of the pdf document.
pdfe.getnofobjects
function pdfe.getnofobjects(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> nobj integer
doc
- Pdf document.
@return nobj
- Number of objects.
Reference:
- Corresponding C source code: lpdfelib.c#L1040-L1047
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return number of objects referenced in the XREF table.
pdfe.getnofpages
function pdfe.getnofpages(document: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> npages integer
document
- Pdfe document.
@return npages
- Number of pages.
Reference:
- Corresponding C source code: lpdfelib.c#L1049-L1056
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the number of pages of the pdf document.
pdfe.getmemoryusage
function pdfe.getmemoryusage(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
})
-> used integer
-> waste integer
doc
- Pdfe document.
@return used
- Used memory including waste.
@return waste
- Waste (E.g. optional keys of pdf objects that are not used.)
Reference:
- Corresponding C source code: lpdfelib.c#L1058-L1069
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return memory usage of pplib library in bytes.
pdfe.getcatalog
function pdfe.getcatalog(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> catalog PdfeDictionary
doc
- Pdfe document.
@return catalog
- Catalog of the pdf.
Reference:
- Corresponding C source code: lpdfelib.c#L465-L471
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return pdf catalog.
pdfe.gettrailer
function pdfe.gettrailer(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> trailor PdfeDictionary
doc
- Pdfe document
@return trailor
- Trailer of the pdf.
Reference:
- Corresponding C source code: lpdfelib.c#L473-L479
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return pdf trailer.
pdfe.getinfo
function pdfe.getinfo(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> info PdfeDictionary
doc
- Pdfe document
@return info
- Info of the pdf.
Reference:
- Corresponding C source code: lpdfelib.c#L481-L487
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return pdf info.
pdfe.getpage
function pdfe.getpage(
doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
},
page: integer
) -> page PdfeDictionary
doc
- Pdfe document.
@param page
- Page number.
@return page
- Page object.
Reference:
- Corresponding C source code: lpdfelib.c#L1091-L1099
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a specific pdf page.
pdfe.getpages
function pdfe.getpages(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> table table<PdfeDictionary>
doc
- Pdfe document.
@return table
- Lua table.
Each item of the returned table is a PdfeDictionary of one page of the pdf.
Reference:
- Corresponding C source code: lpdfelib.c#L1114-L1122
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a table of pages.
pdfe.getbox
function pdfe.getbox(
page: PdfeDictionary,
bbox_name: ("MediaBox"|"CropBox"|"BleedBox"|"TrimBox"|"ArtBox")
) -> bbox number[]
page
- Pdfe dictionary.
@param bbox_name
- Name of bounding box.
@return bbox
- [llx lly urx ury]
Reference:
- Corresponding C source code: lpdfelib.c#L1136-L1161
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return bounding box of a pdf page.
pdfe.getstring
function pdfe.getstring(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: integer
) -> string string
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return string
- If the pdf string is hex encoded then the returned string is hex encoded too.
Reference:
- Corresponding C source code: lpdfelib.c#L1342-L1369
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf string object as a string.
pdfe.getstring
function pdfe.getstring(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer),
decode: boolean
)
-> string string
-> was_encoded boolean
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@param decode
- True
, if a hex encoded string shall be decoded.
@return was_encoded
- True
, if string was hex encoded. Return value was_encoded
is only available if decode
is false
.
Reference:
- Corresponding C source code: lpdfelib.c#L1342-L1369
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf string object as a string.
pdfe.getinteger
function pdfe.getinteger(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> value integer
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return value
- Integer.
Reference:
- Corresponding C source code: lpdfelib.c#L1371-L1383
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf integer object as integer.
pdfe.getnumber
function pdfe.getnumber(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> value number
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
Return a pdf number object as number.
pdfe.getboolean
function pdfe.getboolean(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> value boolean
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
Return a pdf boolean value as boolean.
pdfe.getname
function pdfe.getname(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> value string
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return value
- Name.
Reference:
- Corresponding C source code: lpdfelib.c#L1413-L1425
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf name object as string.
pdfe.type
function pdfe.type(pdfe_obj: (PdfeDocument|PdfeDictionary|PdfeArray|PdfeStream|PdfeReference)) -> pdfe_type string?
@return pdfe_type
- Type of pdfe object.
Note: Returns nil
for all other objects like integer, string, etc.
Reference:
- Corresponding C source code: lpdfelib.c#L224-L235
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a string representing the pdfe type of
returned string | type of <pdfe_obj> |
---|---|
pdfe | PdfeDocument |
pdfe.dictionary | PdfeDictionary |
pdfe.array | PdfeArray |
pdfe.stream | PdfeStream |
pdfe.reference | PdfeReference |
pdfe.getdictionary
function pdfe.getdictionary(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> dict PdfeDictionary
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return dict
- Pdfe dictionary.
Reference:
- Corresponding C source code: lpdfelib.c#L1427-L1437
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf dictionary as a pdfe dictionary.
pdfe.getarray
function pdfe.getarray(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
) -> array PdfeArray
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return array
- Pdfe array.
Reference:
- Corresponding C source code: lpdfelib.c#L1439-L1449
Return a pdf array as a pdfe array.
pdfe.getstream
function pdfe.getstream(
dict_or_array: (PdfeDictionary|PdfeArray),
key_or_index: (string|integer)
)
-> stream PdfeStream
-> dict PdfeDictionary
dict_or_array
- Pdfe dictionary or array.
@param key_or_index
- Key or index.
@return stream
- Pdfe stream.
@return dict
- Pdfe dictionary of the stream.
Reference:
- Corresponding C source code: lpdfelib.c#L1451-L1461
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a pdf stream as a pdfe stream.
The corresponding dictionary of the stream is returned too.
pdfe.getfromstream
function pdfe.getfromstream(
stream: PdfeStream,
key: integer
)
-> type integer
-> value any
-> details any
@return type
- Integer representing the type of a value. (See table below.)
@return value
- The value itself.
@return details
- Details about this value. (See table below.)
Reference:
- Corresponding C source code: lpdfelib.c#L544-L570
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a value of a pdf stream dictionary, including low level details about this value.
Like pdfe.getfromdictionary()
except that this functions works on a 'dictionary of a stream'.
Type | PDF type | Lua type | Details |
---|---|---|---|
0 | none |
nil |
|
1 | null |
nil |
|
2 | boolean |
boolean |
|
3 | integer |
integer |
|
4 | number |
number |
|
5 | name |
string |
|
6 | string |
string |
Is_hex? (1) |
7 | array |
PdfeArray |
Size of array |
8 | dictionary |
PdfeDictionary |
Size of dictionary |
9 | stream |
PdfeStream |
PdfeDictionary |
10 | reference |
PdfeReference |
Number of reference |
(1) true
, for hexadecimal string, false
for normal string
pdfe.openstream
@param
stream
- Pdfe stream object.
@param decode
- True
, if stream should be decompressed.
@return okay
- True
, if reading the stream was successful.
Reference:
- Corresponding C source code: lpdfelib.c#L764-L778
😱 Types incomplete or incorrect? 🙏 Please contribute!
Open a stream.
pdfe.closestream
@param
stream
- Pdfe stream object
Reference:
- Corresponding C source code: lpdfelib.c#L780-L791
😱 Types incomplete or incorrect? 🙏 Please contribute!
Close a stream.
pdfe.readfromstream
@param
stream
- Pdfe stream object.
@return contents
- Contents of stream.
@return size
- Length of stream.
Reference:
- Corresponding C source code: lpdfelib.c#L793-L812
😱 Types incomplete or incorrect? 🙏 Please contribute!
Read a stream object in chunks.
pdfe.readwholestream
function pdfe.readwholestream(
stream: PdfeStream,
decode: boolean
)
-> contents string
-> size integer
stream
- Pdfe stream object.
@param decode
- True
, if stream should be decompressed.
@return contents
- Contents of stream.
@return size
- Length of stream.
Reference:
- Corresponding C source code: lpdfelib.c#L728-L750
😱 Types incomplete or incorrect? 🙏 Please contribute!
Read stream object as a whole.
Opening and closing the stream with pdfe.openstream()
and pdfe.closestream()
is not necessary.
pdfe.pagestotable
function pdfe.pagestotable(doc: PdfeDocument {
catalog = any,
Catalog = any,
info = any,
Info = any,
trailer = any,
Trailer = any,
pages = any,
Pages = any,
}) -> table table
doc
- Pdfe document.
@return table
- Lua table.
Each item (page) of the returned table is a table itself like this:
{ page, size, objnum }
* page
- pdfe dictionary of a page
* size
- number of keys of the page
dictionary
* objnum
- pdf object number of the page object
Reference:
- Corresponding C source code: lpdfelib.c#L686-L716
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a table in which each item represents one page of a pdf.
pdfe.getfromdictionary
function pdfe.getfromdictionary(
dict: PdfeDictionary,
key: string
)
-> type integer
-> value any
-> details any
@return type
- Integer representing the type of a value. (See table below.)
@return value
- The value itself.
@return details
- Details about this value. (See table below.)
Reference:
- Corresponding C source code: lpdfelib.c#L517-L542
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a value of a pdf dictionary, including low level details about this value.
Type | PDF type | Lua type | Details |
---|---|---|---|
0 | none |
nil |
|
1 | null |
nil |
|
2 | boolean |
boolean |
|
3 | integer |
integer |
|
4 | number |
number |
|
5 | name |
string |
|
6 | string |
string |
Is_hex? (1) |
7 | array |
PdfeArray |
Size of array |
8 | dictionary |
PdfeDictionary |
Size of dictionary |
9 | stream |
PdfeStream |
PdfeDictionary |
10 | reference |
PdfeReference |
Number of reference |
(1) true
, for hexadecimal string, false
for normal string
pdfe.getfromarray
function pdfe.getfromarray(
array: PdfeArray,
index: integer
)
-> type integer
-> value any
-> details any
@return type
- Integer representing the type of a value. (See table below.)
@return value
- The value itself.
@return details
- Details about this value. (See table below.)
Reference:
- Corresponding C source code: lpdfelib.c#L501-L515
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return a value of a pdf dictionary, including low level details about this value.
Type | PDF type | Lua type | Details |
---|---|---|---|
0 | none |
nil |
|
1 | null |
nil |
|
2 | boolean |
boolean |
|
3 | integer |
integer |
|
4 | number |
number |
|
5 | name |
string |
|
6 | string |
string |
Is_hex? (1) |
7 | array |
PdfeArray |
Size of array |
8 | dictionary |
PdfeDictionary |
Size of dictionary |
9 | stream |
PdfeStream |
PdfeDictionary |
10 | reference |
PdfeReference |
Number of reference |
(1) true
, for hexadecimal string, false
for normal string
pdfe.dictionarytotable
@param
dict
- Pdfe dictionary.
@return table
- Lua table
This function returns a lua table. Its keys are the keys of the pdfe dictionary and its values are what pdfe.getfromdictionary(dict, key)
returns.
Reference:
- Corresponding C source code: lpdfelib.c#L651-L674
😱 Types incomplete or incorrect? 🙏 Please contribute!
Convert a pdfe dictionary into a lua table.
pdfe.arraytotable
@param
array
- Pdfe array.
@return table
- Lua table
This function returns a lua table. Its indices are the indices of the pdfe array and its values are what pdfe.getfromarray(array, index)
returns.
Reference:
- Corresponding C source code: lpdfelib.c#L628-L649
😱 Types incomplete or incorrect? 🙏 Please contribute!
Convert a pdfe array into a lua table.
pdfe.getfromreference
@return type
- Type of value. (See table below.)
@return value
- The value itself.
@return details
- Details about this value. (See table below.)
Reference:
- Corresponding C source code: lpdfelib.c#L1174-L1188
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the value of a reference, including low level details about this value.
Type | PDF type | Lua type | Details |
---|---|---|---|
0 | none |
nil |
|
1 | null |
nil |
|
2 | boolean |
boolean |
|
3 | integer |
integer |
|
4 | number |
number |
|
5 | name |
string |
|
6 | string |
string |
Is_hex? (1) |
7 | array |
PdfeArray |
Size of array |
8 | dictionary |
PdfeDictionary |
Size of dictionary |
9 | stream |
PdfeStream |
PdfeDictionary |
10 | reference |
PdfeReference |
Number of reference |
(1) true
, for hexadecimal string, false
for normal string