A C# library for communicating with the PrintNode API
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"
}
]
var computerId = 12777;
var computer = await PrintNodeComputer.GetAsync(computerId);
var printers = await PrintNodePrinter.ListAsync();
var printerId = 38409;
var printer = await PrintNodePrinter.GetAsync(printerId);
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);
var printerId = 38409;
var printJobs = await PrintNodePrintJob.ListForPrinterAsync(printerId);
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;
using (new PrintNodeDelegatedClientContext(accountId))
{
var printers = PrintNodePrinter.ListAsync();
}