Importing Print Job Details

In some environments it may be desirable to import print jobs that have been tracked by external or third party systems into PaperCut NG. This could be because the external system is not easily tracked directly, or to import data that was previously tracked for logging and reporting purposes.

Job details may be importing using the server-command scripting tool (process-job command, see the section called “Server Commands (server-command)”) or using the web services API (api.processJob call, see the section called “The XML Web Services API”). To import multiple jobs in a batch, run the command/call multiples times (e.g. via a script or program).

The server-command and web services call accept a single argument (string) containing all the job details. Each field is specified as a name-value pair separated by an equals sign (i.e. name=value), and fields are separated by commas.

For example, to process a job and specify the user, printer server and printer name (the minimum required details):

user=bob,server=papercut,printer=My Printer

If any fields contain a comma, surround the name-value pair with quotation marks ("). E.g. for a printer named Library, rear:

user=bob,server=papercut,"printer=Library, rear"

Spreadsheet applications such as Excel with automatically add quotation marks as above when saving a document in CSV format.

If any fields contain quotation marks, escape them by adding another quotation mark, i.e. two in a row. E.g. for a printer named "John Smith" Library:

user=bob,server=papercut,printer=""John Smith"" Library

The names of all the available fields are listed in the table below.

FieldRequiredDescriptionDefault

user

Yes

The username of the user associated with the job.

N/A

server

Yes

The name of the server the job was submitted to.

N/A

printer

Yes

The name of the printer or print queue the job was submitted to.

N/A

time

No

The time the job was submitted/printed. This is formatted as an ISO8601 simple date-time: yyyyMMddTHHmmss. E.g. "20091224T133602" represents the 24th of December 2009 at 13:36:02 (1:36 pm, local time).

(current time)

cost

No

The cost of the job. If the cost is not set it will be automatically calculated as for a normal job (based on the job details and configuration of the printer, user etc.).

(auto)

total-pages

No

The total number of pages in the job.

1

total-color-pages

No

The total number of color pages in the job.

(same as total-pages)

copies

No

The number of copies in the job.

1

document-name

No

The document name.

(empty)

duplex

No

TRUE or FALSE to indicate if the job is duplex (printed on both sides)

FALSE

grayscale

No

TRUE or FALSE to indicate if the job is grayscale (no color)

FALSE

job-type

No

The type of job to import. Options include: COPY, FAX, PRINT, SCAN.

PRINT

paper-size-name

No

The name of a standard paper size, e.g. "Letter" or "A4".

(empty)

paper-width-mm

No

The width of the paper in millimeters. Determined automatically if using paper-size-name.

(empty)

paper-height-mm

No

The height of the paper in millimeters. Determined automatically if using paper-size-name.

(empty)

document-size-kb

No

The size of the document's spool file in kilobytes.

0

invoice

No

TRUE to mark the job as invoiced, FALSE to mark as not invoiced. The default value is determined automatically, as for a regular job.

(auto)

comment

No

A comment to be associated with the job.

(empty)

client-machine

No

The hostname of the client machine the job was submitted from.

(empty)

client-ip

No

The IP address of the client machine the job was submitted from.

(empty)

shared-account

No

The name of the shared account to charge this job to. Sub-accounts may be selected using a backslash, i.e. "parent\child".

(empty)

Table A.4. Fields for Importing Print Job Details