Skip to content

global pdf

This library contains variables and functions that are related to the PDF backend.

😱 Types incomplete or incorrect? 🙏 Please contribute!


methods


pdf.mapfile


function pdf.mapfile(map_file: string)
@param map_file - File name of map-file. The first character of has a special meaning: * '+' Add new entries, if they do not exist already. * '=' Replace existing entries. * '-' Remove entries, if they exist. * '' Flush map file first, then insert new entries.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Modify the map-file.

This function modifies the map-file by adding, replacing, or removing all entries (lines) of .

pdf.mapline


function pdf.mapline(map_line: string)
@param map_line - Entry (line) to be added, replace, or removed. The first character of has a special meaning: * '+' Insert new entry, if it doesn't exist already. * '=' Replace existing entry. * '-' Remove entry, if it exists. * '' Flush map file first, then insert new entry.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Modify the map-file.

This function modifies the map-file by adding, replacing, or removing exactly one entry (line).

pdf.setcatalog


function pdf.setcatalog(catalog: string)
@param catalog - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the /Catalog dictionary.

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.getcatalog

pdf.getcatalog


function pdf.getcatalog() -> catalog string?

@return catalog - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setcatalog().

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setcatalog

pdf.setinfo


function pdf.setinfo(info: string)
@param info - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the /Info dictionary.

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.getinfo

pdf.getinfo


function pdf.getinfo() -> info string?

@return info - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setinfo().

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setinfo

pdf.setnames


function pdf.setnames(names: string)
@param names - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the /Names dictionary of the /Catalog.

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.getnames

pdf.getnames


function pdf.getnames() -> names string?

@return names - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setnames().

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setnames

pdf.settrailer


function pdf.settrailer(trailer: string)
@param trailer - String. FIXME: pdf.settrailer() not working. Bug?

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the trailer dictionary.

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.gettrailer

pdf.gettrailer


function pdf.gettrailer() -> trailer string?

@return trailer - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.settrailer().

This function complements the corresponding PDF backend token lists dealing with metadata. The value is written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.settrailer

pdf.setpageattributes


function pdf.setpageattributes(attributes: string)
@param attributes - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the current /Page dictionary.

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

---* Corresponding C source code: lpdflib.c#L610

@see pdf.getpageattributes

pdf.getpageattributes


function pdf.getpageattributes() -> attributes string?

@return attributes - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setpageattributes().

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setpageattributes

pdf.setpageresources


function pdf.setpageresources(resources: string)
@param resources - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the /Resources dictionary of the current page.

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.getpageresources

pdf.getpageresources


function pdf.getpageresources() -> resources string?

@return resources - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setpageresources().

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setpageresources

pdf.setpagesattributes


function pdf.setpagesattributes(attributes: string)
@param attributes - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Insert string into the /Pages dictionary of the /Catalog.

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

Reference:

@see pdf.setpageattributes

pdf.getpagesattributes


function pdf.getpagesattributes() -> attributes string?

@return attributes - String.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return string that was set by pdf.setpageattributes().

This function complements the corresponding PDF backend token lists dealing with page resources. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setpageattributes

pdf.setxformattributes


function pdf.setxformattributes()

This function complements the corresponding PDF backend token lists dealing with reuseable boxes and images. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.getxformattributes

pdf.getxformattributes


function pdf.getxformattributes()

This function complements the corresponding PDF backend token lists dealing with reuseable boxes and images. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setxformattributes

pdf.setxformresources


function pdf.setxformresources()

This function complements the corresponding PDF backend token lists dealing with reuseable boxes and images. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.getxformresources

pdf.getxformresources


function pdf.getxformresources()

This function complements the corresponding PDF backend token lists dealing with reuseable boxes and images. The variables have no interaction with the corresponding PDF backend token register. They are written to the PDF file directly after the token registers set at the TeX end are written.

@see pdf.setxformresources

pdf.setmajorversion


function pdf.setmajorversion(n: integer)
@param n - Major version number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set major version number of the PDF file format.

Note: This function sets the version number of the file header. It does not set the /Version key of the /Catalog as recommended for PDF-1.4 and later.

The major version is normally 1 but when set to 2 some data will not be written to the file in order to comply with the standard. What minor version you set depends on what PDF features you use. This is out of control of LuaTeX.

One can set the major version number to 2 but we cannot guarantee that the engine adapts itself correctly, because there is no public and free specification that we know of. Also, user constructed annotations are not checked and just passed to the file. On the other hand, the PDF that the engine generated is rather simple and not that version depending.

@see pdf.getmajorversion

pdf.getmajorversion


function pdf.getmajorversion() -> n integer

@return n - Major version number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return major version number of the PDF file format.

@see pdf.setmajorversion

pdf.setminorversion


function pdf.setminorversion(n: integer)
@param n - Minor version number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set minor version number of the PDF file format.

Note: This function sets the version number of the file header. It does not set the /Version key of the /Catalog as recommended for PDF-1.4 and later.

@see pdf.getmajorversion

pdf.getminorversion


function pdf.getminorversion() -> n integer

@return n - Minor version number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return minor version number of the PDF file format.

@see pdf.setminorversion

pdf.getcreationdate


function pdf.getcreationdate() ->  string

Return the /CreationDate string of the /Info dictionary.

pdf.setinclusionerrorlevel


function pdf.setinclusionerrorlevel(level: integer)

Set error level for inserting PDF files.

A warning/error is issued if the inserted PDF file has a newer version number than the main PDF file. * level <= 0: Issue a warning. * level > 0: Issue an error.

pdf.getinclusionerrorlevel


function pdf.getinclusionerrorlevel() -> level integer

@return level - Error level.

Return value set by pdf.setinclusionerrorlevel().

@see pdf.setinclusionerrorlevel

pdf.setignoreunknownimages


function pdf.setignoreunknownimages(ignore: integer)
@param ignore - Ignore image.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set status for inserting images. * ignore ~= 0: Issue a warning if image file type is unknown. * ignore == 0: Issue an error if image file type is unknown. LuaTeX can handle these file types: pdf, png, jpg, jbig2

pdf.getignoreunknownimages


function pdf.getignoreunknownimages() -> ignore integer

@return ignore - Ignor image.

Return status.

@see pdf.setignoreunknownimages

pdf.setsuppressoptionalinfo


function pdf.setsuppressoptionalinfo(flags: integer)
@param flags - Bit field.


Bit Meaning


1 /PTEX.FullBanner in /Info dictionary of the trailer. 2 /PTEX.FileName in /XObject dictionary of an image. (1) 4 /PTEX.PageNumber in /XObject dictionary of an image. 8 /PTEX.InfoDict in /XObject dictionary of an image. 16 /Creator in /Info dictionary of the trailer. 32 /CreationDate in /Info dictionary of the trailer. 64 /ModDate in /Info dictionary of the trailer. 128 /Producer in /Info dictionary of the trailer. 256 /Trapped in /Info dictionary of the trailer. 512 /ID of the trailer.


(1) Seems to work only if '\pdfvariable imageaddfilename = 1'

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set bit field suppressing certain informational keys in the PDF file.

pdf.getsuppressoptionalinfo


function pdf.getsuppressoptionalinfo() -> flags integer

@return flags - Bit field.

Return bit field set by pdf.setsuppressoptionalinfo().

@see pdf.setsuppressoptionalinfo

pdf.settrailerid


function pdf.settrailerid(id: string)
@param id - Trailer ID.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set /ID of the trailer.

pdf.gettrailerid


function pdf.gettrailerid() -> id string

@return id - Trailer ID.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return /ID of the trailer.

pdf.setomitcidset


function pdf.setomitcidset(n: integer)

Add or remove /CIDSet entry in /FontDescriptor. * n ~= 0: Remove /CIDSet entry. * n == 0: Add /CIDSet entry.

pdf.getomitcidset


function pdf.getomitcidset() -> flag integer

Return set by pdf.setomitcidset().

@see pdf.setomitcidset

pdf.setomitcharset


function pdf.setomitcharset(n: integer)

Add or remove /CharSet entry in /FontDescriptor. * n ~= 0: Remove /CharSet entry. * n == 0: Add /CharSet entry.

pdf.getomitcharset


function pdf.getomitcharset() -> n integer

Return value set by pdf.setomitcharset().

@see pdf.setomitcharset

pdf.setcompresslevel


function pdf.setcompresslevel(level: integer)
@param level - Minimum: 0, Maximum: 9

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set compression level of streams.

pdf.getcompresslevel


function pdf.getcompresslevel() -> level integer

@return level - Compression level.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return compression level of streams.

pdf.setobjcompresslevel


function pdf.setobjcompresslevel(level: integer)
@param level - Minimum: 0, Maximum: 9

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set compression level of objects.

pdf.getobjcompresslevel


function pdf.getobjcompresslevel() -> level integer

@return level - Compression level.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return compression level of objects.

pdf.setrecompress


function pdf.setrecompress(switch: integer)
@param switch - 0: don't recompress, 1: do recompress. FIXME: pdf.setrecompress() not working. Bug?

😱 Types incomplete or incorrect? 🙏 Please contribute!

Switch for recompressing streams of /XObjects.

pdf.getrecompress


function pdf.getrecompress() -> switch integer

@return switch - 0: don't recompress, 1: do recompress.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return value set by pdf.setrecompress().

pdf.setgentounicode


function pdf.setgentounicode(n: integer)

Add or remove /ToUnicode entry in a font dictionary.

pdf.getgentounicode


function pdf.getgentounicode() -> n integer

Return value set by pdf.setgentounicode().

@see pdf.setgentounicode

pdf.setdecimaldigits


function pdf.setdecimaldigits(ndigits: integer)
@param ndigits - Number of decimal digits.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set number of decimal digits used for writing numbers (floats) in the PDF file.

pdf.getdecimaldigits


function pdf.getdecimaldigits() -> ndigits integer

@return ndigits - Number of digits.

Return value set by pdf.setdecimaldigits().

@see pdf.setdecimaldigits

pdf.setpkresolution


function pdf.setpkresolution(
  resolution: integer,
  fixed_dpi: integer
)

Set resolution of PK fonts.

pdf.getpkresolution


function pdf.getpkresolution()
 -> resolution integer
 -> fixed_dpi integer

Return resolution of PK fonts.

pdf.getlastobj


function pdf.getlastobj() -> objnum integer

@return objnum - Number of latest created object.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return object number of latest created objects.


function pdf.getlastlink() -> objnum integer

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return object number of latest created /Annot object (subtype /Link) that was created by /pdfextension startlink.

pdf.getlastannot


function pdf.getlastannot() -> objnum integer

@return objnum - Number of latest created object.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return object number of latest created /Annot object that was created by pdf.reserveobj('annot').

pdf.getretval


function pdf.getretval()

Warning! Undocumented code!

TODO: Please contribute https://github.com/Josef-Friedrich/LuaTeX_Lua-API#how-to-contribute

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.getmaxobjnum


function pdf.getmaxobjnum() -> objnum integer

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return the object number of the latest created pdf object.

pdf.getobjtype


function pdf.getobjtype(objnum: integer)
@param objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return a string describing the object type.

pdf.getfontname


function pdf.getfontname(id: integer) ->  integer
@param id - Font ID.

Return the number of the font resource name. The /Font entry of a /Resource dictionary maps resource names to font dictionaries. LuaTeX uses resource names like /F36 or /F52, where the number corresponds to the font ID.

pdf.getfontobjnum


function pdf.getfontobjnum(id: integer) -> objnum integer
@param id - Font ID.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return the object number of the /Font dictionary.

pdf.getfontsize


function pdf.getfontsize(id: integer) ->  integer
@param id - Font ID.

@return - Font size.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return the font size in scaled points.

pdf.getxformname


function pdf.getxformname()

Warning! Undocumented code!

TODO: Please contribute https://github.com/Josef-Friedrich/LuaTeX_Lua-API#how-to-contribute

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.setorigin


function pdf.setorigin(
  h: integer,
  v: integer
)
@param h - Horizontal offset in scaled points.

@param v - Vertical offset in scaled points.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set horizontal and vertical offset from the top left corner of the page.

pdf.getorigin


function pdf.getorigin()
 -> h integer
 -> v integer

@return h - Horizontal offset in scaled points.

@return v - Vertical offset in scaled points.

Return values set by pdf.setorigin().

@see pdf.setorigin

pdf.setimageresolution


function pdf.setimageresolution(dpi: integer)
@param dpi - Resolution. LuaTeX determines the size of an image as follows: 1. It uses and parameter of \useimageresource. 2. If (1) is missing, it uses the resolution given in the metadata of the image. 3. If (2) is missing, it uses the resolution given by this function. 4. If (3) is missing, it uses a resolution of 72 dpi.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set default resolution of a bitmap image.

pdf.getimageresolution


function pdf.getimageresolution() -> dpi integer

@return dpi - Resolution.

Return value set by pdf.setimageresolution().

@see pdf.setimageresolution

pdf.setlinkmargin


function pdf.setlinkmargin(margin: integer)
@param margin - Margin in scaled points.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set margin size of hyperlinks.

pdf.getlinkmargin


function pdf.getlinkmargin() -> margin integer

@return margin - Margin in scaled points.

Return value set by pdf.setlinkmargin().

@see pdf.setlinkmargin

pdf.setdestmargin


function pdf.setdestmargin(margin: integer)
@param margin - Margin in scaled points. FIXME pdf.setdestmargin() is not working. Bug?

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set margin size of destination.

pdf.getdestmargin


function pdf.getdestmargin() -> margin integer

@return margin - Margin in scaled points.

Return value set by pdf.setdestmargin().

@see pdf.setdestmargin

pdf.setthreadmargin


function pdf.setthreadmargin(margin: integer)
@param margin - Margin in scaled points.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Set size of margin for threads.

pdf.getthreadmargin


function pdf.getthreadmargin() -> margin integer

@return margin - Margin in scaled points.

Return value set by pdf.setthreadmargin().

@see pdf.setthreadmargin

pdf.setxformmargin


function pdf.setxformmargin()

Warning! Undocumented code!

TODO: Please contribute https://github.com/Josef-Friedrich/LuaTeX_Lua-API#how-to-contribute

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.getxformmargin


function pdf.getxformmargin()

Warning! Undocumented code!

TODO: Please contribute https://github.com/Josef-Friedrich/LuaTeX_Lua-API#how-to-contribute

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.getpos


function pdf.getpos()
 -> h integer
 -> v integer

@return h - Horizontal position in scaled points.

@return v - Vertical position in scaled points.

Note: This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return coordinates of the current position. The origin of the coordinate system is at the lower left corner of the page.

pdf.gethpos


function pdf.gethpos() -> h integer

@return h - Horizontal position in scaled points. Note: This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return horizontal coordinate of the current position. The origin of the coordinate system is at the lower left corner of the page.

pdf.getvpos


function pdf.getvpos() -> v integer

@return v - Vertical position in scaled points.

Note: This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return vertical coordinate of the current position. The origin of the coordinate system is at the lower left corner of the page.

pdf.hasmatrix


function pdf.hasmatrix() -> Note boolean

@return Note - : This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Returns true is a CTM is currently used.

pdf.getmatrix


function pdf.getmatrix()
 -> a integer
 -> b integer
 -> c integer
 -> d integer
 -> e integer
 -> f integer

Return the CTM (current transformation matrix) at the current position. ┌ ┐ │ a b 0 │ │ c d 0 │ │ e f 1 │ └ ┘

pdf.print


function pdf.print(str: string)
@param str - String.

Note: This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Write a string into the contents stream of the current page. If LuaTeX is currently inside a text block (BT...ET), close the text block first.

pdf.print


function pdf.print(
  type: string,
  str: string
)
@param type - Type.

@param str - String. Parameter determines how the string is written: * text: String is written inside a text block (BT...ET). * page: String is written outside a text block (BT...ET). * origin: Like page but the CTM is inserted just before the string . * direct: String is written directly, independ of whether this is inside or outside a text block. * raw: Like direct. -Note: This function is mainly used inside \latelua calls.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Write a string into the contents stream of the current page.

pdf.immediateobj


function pdf.immediateobj(str: string) -> objnum integer
@param str - Contents of the object.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object and write it immediately to the pdf file.

The created object looks like this:

0 obj endobj

pdf.immediateobj


function pdf.immediateobj(
  objnum: integer?,
  file: string,
  filename: string
) -> objnum integer
@param objnum - Object number (optional argument).

@param file - Literal string "file".

@param filename - File name.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object and write it immediately to the pdf file. The created object looks like this:

0 obj > endobj

pdf.immediateobj


function pdf.immediateobj(
  stream: string,
  streamcontents: string,
  streamdict: string
) -> objnum integer
@param stream - Literal string "stream".

@param streamcontents - Contents of the stream.

@param streamdict - Stream dictionary.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object and write it immediately to the pdf file.

The created object looks like this:

0 obj << /Length 123 >> stream endstream endobj

pdf.immediateobj


function pdf.immediateobj(
  streamfile: string,
  filename: string,
  streamdict: string
) -> objnum integer
@param streamfile - Literal string "streamfile".

@param filename - File name.

@param streamdict - Stream dictionary.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object and write it immediately to the pdf file.

The created object looks like this:

0 obj << file \> /Length 123 >> stream endstream endobj

pdf.obj


function pdf.obj(str: string) -> objnum integer
@param str - Contents of the object.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object.

This object is written to the pdf file only if it is referenced later by pdf.refobj() The created object looks like this:

0 obj endobj

pdf.obj


function pdf.obj(
  objnum: integer?,
  file: string,
  filename: string
) -> objnum integer
@param objnum - Object number (optional argument).

@param file - Literal string "file".

@param filename - File name.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object.

This object is written to the pdf file only if it is referenced later by pdf.refobj() The created object looks like this:

0 obj > endobj

pdf.obj


function pdf.obj(
  stream: string,
  streamcontents: string,
  streamdict: string
) -> objnum integer
@param stream - Literal string "stream".

@param streamcontents - Contents of the stream.

@param streamdict - Stream dictionary.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object.

This object is written to the pdf file only if it is referenced later by pdf.refobj() The created object looks like this:

0 obj << /Length 123 >> stream endstream endobj

pdf.obj


function pdf.obj(
  streamfile: string,
  filename: string,
  streamdict: string
) -> objnum integer
@param streamfile - Literal string "streamfile".

@param filename - File name.

@param streamdict - Stream dictionary.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object.

This object is written to the pdf file only if it is referenced later by pdf.refobj() The created object looks like this:

0 obj << file \> /Length 123 >> stream endstream endobj

pdf.obj


function pdf.obj(keyvals: table) -> objnum integer
@param keyvals - Object specification.

keyvals = { type = , -- 'stream' (stream object), 'raw' (non-stream object) immediate = , objnum = , -- object number attr = , -- stream dictionary compresslevel = , objcompression = , file = , -- contents of object/stream string = , -- contents of object/stream nolength = , -- omit /Length entry of stream dictionary } Keys string and file are mutual exclusive. Key nolength omits /Length entry of the stream dictionary only if a /Length entry is given in the attr key.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Create an object.

pdf.refobj


function pdf.refobj(objnum: integer)
@param objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Write referenced object to pdf file.

pdf.reserveobj


function pdf.reserveobj() -> objnum integer

@return objnum - Object number.

Create an empty object.

Use pdf.obj() or pdf.immediateobj() to define this object.

@see pdf.obj pdf.immediateobj

pdf.reserveobj


function pdf.reserveobj(annot: string) -> objnum integer
@param annot - Literal string 'annot'.

@return objnum - Object number.

Create a annotation object.

Annotation object are not written to file directly but must be registered with pdf.registerannot().

@see pdf.registerannot

pdf.getpageref


function pdf.getpageref(pagenum: integer) -> objnum integer
@param pagenum - Page number.

@return objnum - Object number.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return object number of page .

This can be a forwar reference, i.e. page doesn't have to be created yet.

pdf.registerannot


function pdf.registerannot(objnum: integer)
@param objnum - Object number of /Annot object.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Add an /Annot object to the /Annots dictionary.

pdf.newcolorstack


function pdf.newcolorstack(
  s: string,
  literal_mode: ("page"|"direct"|"origin"|"text"|"raw"),
  page_start: boolean
) -> color_stack_id integer

Allocate a new color stack and returns it's id. The arguments are the same as for the similar backend extension primitive.

pdf.newcolorstack("0 g","page",true) --

Reference:

pdf.setfontattributes


function pdf.setfontattributes(
  font_id: integer,
  pdf_code: integer
)

Force some additional code into the font resource.

It can for instance be used to add a custom ToUnicode vector to a bitmap file.

Reference:

pdf.fontname


function pdf.fontname()

@deprecated Deprecated

@see pdf.getfontname

pdf.fontsize


function pdf.fontsize()

@deprecated Deprecated

@see pdf.getpdffontsize

pdf.maxobjnum


function pdf.maxobjnum() -> n integer

@return n - Number of objects.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return how many objects were created so far.

pdf.getnofobjects


function pdf.getnofobjects()
 -> written_obj integer
 -> not_written_obj integer

@return written_obj - Object written to file.

@return not_written_obj - Object not yet written to file.

😱 Types incomplete or incorrect? 🙏 Please contribute!

Return number of object that are written or not yet written to file.

Reference:

pdf.includechar


function pdf.includechar()

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.includefont


function pdf.includefont()

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.includeimage


function pdf.includeimage()

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.objtype


function pdf.objtype()

@deprecated Deprecated

@see pdf.getobjtype

pdf.pageref


function pdf.pageref()

@deprecated Deprecated

@see pdf.getpageref

pdf.setforcefile


function pdf.setforcefile(force: boolean)

Reference:

pdf.settypeonewidemode


function pdf.settypeonewidemode()

Reference:

😱 Types incomplete or incorrect? 🙏 Please contribute!

pdf.xformname


function pdf.xformname()

@deprecated Deprecated

@see pdf.getxformname