A C# library for communicating with the PrintNode API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Http
Properties
.gitignore
LICENSE
PrintNode.Net.csproj
PrintNodeAuthenticationType.cs
PrintNodeChildAccount.cs
PrintNodeChildAccountCreationResponseConverter.cs
PrintNodeComputer.cs
PrintNodeConfiguration.cs
PrintNodeContentType.cs
PrintNodeCredentials.cs
PrintNodeDelegatedClientContext.cs
PrintNodeDelegatedClientContextAuthenticationMode.cs
PrintNodeException.cs
PrintNodePrintJob.cs
PrintNodePrintJobAuthentication.cs
PrintNodePrintJobOptions.cs
PrintNodePrintJobState.cs
PrintNodePrinter.cs
PrintNodePrinterCapabilities.cs
PrintNodeScale.cs
PrintNodeScaleMeasurement.cs
README.md
packages.config

README.md

printnode-net

A C# library for communicating with the PrintNode API

Getting started

Let's set up your account first.

Create an API key at printnode.com.

Add the following to your <appsettings>:

<add key="PrintNodeApiKey" value="<your API key>"/>

Install your PrintNode client to the computer of your choice.

Let's make sure your computer has been registered:

var computers = await PrintNodeComputer.ListAsync();
[
  {
    "id": 11,
    "name": "AnalyticalEngine",
    "inet": null,
    "inet6": null,
    "hostname": null,
    "version": null,
    "jre": null,
    "createTimestamp": "2015-06-28T18:29:19.871Z",
    "state": "disconnected"
  }
]

To get a specific computer

var computerId = 12777;
var computer = await PrintNodeComputer.GetAsync(computerId);

To get a list of printers connected to your current account

var printers = await PrintNodePrinter.ListAsync();

To get a specific printer

var printerId = 38409;
var printer = await PrintNodePrinter.GetAsync(printerId);

To add a job to a printer

byte[] pdfDocument = await DownloadPdf("http://test.com/test.pdf");

var printJob = new PrintNodePrintJob
{
    Title = "My cool test print",
    Content = Convert.ToBase64String(pdfDocument),
    ContentType = "raw_pdf"
};

var response = await printer.AddPrintJob(printJob);

To list print jobs for a printer

var printerId = 38409;
var printJobs = await PrintNodePrintJob.ListForPrinterAsync(printerId);

To create a child account

var childAccount = new PrintNodeChildAccount
{
	FirstName = "First name",
	LastName = "Last name",
	Email = "email@test.com",
	Password = "password",
	CreatorRef = "a cool ref"
};

var response = await childAccount.CreateAsync();

var accountId = response.Id.Value;

To get a list of printers on behalf of a child account

using (new PrintNodeDelegatedClientContext(accountId))
{
	var printers = PrintNodePrinter.ListAsync();
}