laravel-printing
PrintNode
PrintJob Service
On this page
Introduction
The PrintJobService
can be used to create new print jobs and fetch existing jobs on your PrintNode account.
All methods are callable from the PrintNodeClient
class.
$printJobs = $client->printJobs->all();
See the API Overview for more information on interacting with the PrintNode API.
Reference
Methods
all
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJob>
Retrieve all print jobs associated with a PrintNode account.
param | type | default |
---|---|---|
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
create
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
Create a new print job for PrintNode to send to a physical printer. Note: although the $params
argument accepts an array, it is recommended to send through a PendingPrintJob
object instead.
param | type | default |
---|---|---|
$params |
array|PendingPrintJob | null |
$opts |
null|array|RequestOptions | null |
Example:
use Rawilk\Printing\Api\PrintNode\PendingPrintJob;
use Rawilk\Printing\Api\PrintNode\Enums\ContentType;
$pendingJob = PendingPrintJob::make()
->setContent('hello world')
->setContentType(ContentType::RawBase64)
->setPrinter($printerId)
->setTitle('My job title')
->setSource(config('app.name'));
$printJob = $client->printJobs->create($pendingJob);
retrieve
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
Retrieve a print job by ID.
param | type | default | description |
---|---|---|---|
$id |
int | the print job's ID | |
$params |
array|null | null | not applicable to this request |
$opts |
null|array|RequestOptions | null |
retrieveSet
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJob>
Retrieve a specific set of print jobs.
param | type | default | description |
---|---|---|---|
$ids |
array | the print job IDs | |
$params |
array|null | null | |
$opts |
null|array|RequestOptions | null |
states
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJobState>
Retrieve all print job states for an account.
Note: If a limit
is passed in with $params
, it applies to the amount of print jobs to retrieve states for. For example, if there are 3 print jobs with 5 states each, and a limit of 2 is specified, a total of 10 print job states will be received.
param | type | default |
---|---|---|
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
statesFor
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJobState>
Retrieve the print job states for a given print job.
param | type | default | description |
---|---|---|---|
$parentId |
int|array | the print job's ID | |
$params |
array|null | null | |
$opts |
null|array|RequestOptions | null |
cancelMany
array
Cancel (delete) a set of pending print jobs. Method will return an array of affected IDs. Omit or use an empty array of $ids
to delete all jobs.
param | type | default |
---|---|---|
$ids |
array | |
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
cancel
array
Cancel (delete) a given pending print job. Method will return an array of affected IDs.
param | type | default |
---|---|---|
$id |
int | |
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
PrintJob Resource
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
A PrintJob
represents a print job in the PrintNode API.
Properties
id
int
The print job's ID.
createTimestamp
string
Time and date the print job was created.
printer
Rawilk\Printing\Api\PrintNode\Resources\Printer
The printer the job was sent to.
title
string
The title of the print job.
contentType
string
The content type of the print job.
source
string
A string that describes the origin of the print job.
expireAt
?string
The time at which the print job expires.
state
string
The current state of the print job.
Methods
createdAt
?CarbonInterface
A date object representing the date and time the print job was created.
expiresAt
?CarbonInterface
A date object representing the date and time the print job will expire.
delete
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
Delete (cancel) the print job.
param | type | default |
---|---|---|
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
getStates
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJobState>
Get all the states that PrintNode has reported for the print job.
param | type | default |
---|---|---|
$params |
array|null | null |
$opts |
null|array|RequestOptions | null |
Static Methods
create
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
Create and send a new print job through the PrintNode API.
param | type | default |
---|---|---|
$params |
array|PendingPrintJob | |
$opts |
null|array|RequestOptions | null |
Example:
use Rawilk\Printing\Api\PrintNode\PendingPrintJob;
use Rawilk\Printing\Api\PrintNode\Enums\ContentType;
use Rawilk\Printing\Api\PrintNode\Resources\PrintJob;
$pendingJob = PendingPrintJob::make()
->setContent('hello world')
->setContentType(ContentType::RawBase64)
->setPrinter($printerId)
->setTitle('My job title')
->setSource(config('app.name'));
$printJob = PrintJob::create($pendingJob);
all
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJob>
Retrieve all print jobs.
$printJobs = PrintJob::all();
param | type | default |
---|---|---|
$params |
null|array | null |
$opts |
null|array|RequestOptions | null |
retrieve
Rawilk\Printing\Api\PrintNode\Resources\PrintJob
Retrieve a print job with a given id.
$printJob = PrintJob::retrieve(100);
param | type | default |
---|---|---|
$id |
int | |
$params |
null|array | null |
$opts |
null|array|RequestOptions | null |
PrintJobState Resource
Rawilk\Printing\Api\PrintNode\Resources\PrintJobState
A PrintJobState
represents a state that a PrintJob
was in at a given time in the PrintNode API.
Properties
printJobId
int
The ID of the print job the state is for.
state
string
The state code for the print job.
message
string
Additional information about the state.
clientVersion
?string
If the state was generated by a PrintNode Client, this is the Client's version; otherwise null
.
createTimestamp
string
If the state was generated by a PrintNodeClient, this is the timestamp at which the state was reported to the PrintNode server. Otherwise, it is the timestamp at which the PrintNode Server generated the state.
Methods
createdAt
?CarbonInterface
A date object representing the date and time the state was created for the print job.
Static Methods
all
Collection<int, Rawilk\Printing\Api\PrintNode\Resources\PrintJobState>
Retrieve all print job states.
$states = PrintJobState::all();
param | type | default |
---|---|---|
$params |
null|array | null |
$opts |
null|array|RequestOptions | null |