Exports

Every export of Documents, with its arguments and an example

2 min read · Updated Dec 3, 2026

Client exports

OpenDocumentEditor

Opens the document editor, with a new page or with a saved document.

Side: Client

Arguments

NameTypeRequiredDescription
idnumberNoId of a saved document. Without it a new document is opened.

Returns

Nothing.

How to use it

lua
-- a new document
exports.TopXDocuments:OpenDocumentEditor()

-- a saved document
exports.TopXDocuments:OpenDocumentEditor(15)

Good to know

  • The player needs the permission to use the editor, otherwise a notification is shown.
  • A document of someone else, and a printed paper, open read only.
  • Nothing happens when a TopX window is already open.

OpenPrinter

Opens the printer window, with the settings used for printer props (set in /printeradmin).

Side: Client

Arguments

None.

Returns

Nothing.

How to use it

lua
exports.ox_target:addModel('prop_printer_01', {
    {
        label = 'Print a document',
        onSelect = function() exports.TopXDocuments:OpenPrinter() end,
    },
})

Good to know

  • Printers placed with /printeradmin already have their own target, you do not need this export for them.

openDocument

The use handler of the document item for ox_inventory. It opens the document stored in the item.

Side: Client

Arguments

NameTypeRequiredDescription
itemtableNoThe item data ox_inventory passes first. It is not read.
slottableYesThe used slot. slot.metadata.docId (number) is the document to open.

Returns

Nothing.

How to use it

lua
-- ox_inventory/data/items.lua
['document'] = {
    label = 'Document',
    weight = 10,
    client = { export = 'TopXDocuments.openDocument' },
},

Good to know

  • You normally never call it yourself, ox_inventory does.
  • The item names are in Config.Items.

openPaper

The use handler of the printed paper item for ox_inventory. It shows the printed copy.

Side: Client

Arguments

NameTypeRequiredDescription
itemtableNoThe item data ox_inventory passes first. It is not read.
slottableYesThe used slot. slot.metadata.imageurl (string, with label) shows a picture, otherwise slot.metadata.docId (number) shows the document read only.

Returns

Nothing.

How to use it

lua
-- ox_inventory/data/items.lua
['paper'] = {
    label = 'Printed paper',
    weight = 5,
    client = { export = 'TopXDocuments.openPaper' },
},

Good to know

  • You normally never call it yourself, ox_inventory does.

Items

The names of the items are in Config.Items: the document, the printed paper and the blank paper that a printer uses when it needs paper. The files to add them to your inventory are in INSTALL.