Diagraph-IJAPI_HTTP
1.0.2
dotnet add package Diagraph-IJAPI_HTTP --version 1.0.2
NuGet\Install-Package Diagraph-IJAPI_HTTP -Version 1.0.2
<PackageReference Include="Diagraph-IJAPI_HTTP" Version="1.0.2" />
<PackageVersion Include="Diagraph-IJAPI_HTTP" Version="1.0.2" />
<PackageReference Include="Diagraph-IJAPI_HTTP" />
paket add Diagraph-IJAPI_HTTP --version 1.0.2
#r "nuget: Diagraph-IJAPI_HTTP, 1.0.2"
#:package Diagraph-IJAPI_HTTP@1.0.2
#addin nuget:?package=Diagraph-IJAPI_HTTP&version=1.0.2
#tool nuget:?package=Diagraph-IJAPI_HTTP&version=1.0.2
Diagraph IJ Printer Demo
This is a simple C# program for interfacing with a Diagraph IJ Printer using the Diagraph-IJAPI library. It demonstrates how to search for IJ printers on the network, connect to one, retrieve device information, and interact with the printer.
Prerequisites
Before running this program, ensure you have the following prerequisites:
- Diagraph IJ Printer
- .NET SDK installed
- Diagraph-IJAPI NuGet package (e.g., Diagraph-IJAPI.1.0.2.nupkg)
Getting Started
Create a new C# project in your preferred development environment.
Add the Diagraph-IJAPI NuGet package to your project.
Replace the default code in your project with the provided code.
Build and run the program.
Usage
This program searches for Diagraph IJ printers on the network, connects to the first one found, and performs the following actions:
- Retrieves device information including version, status, errors, device info, and configuration.
- Lists files stored on the printer, such as label files.
Code Explanation
The program uses the
IJAPI.IJAPI
class from the Diagraph-IJAPI library to interact with Diagraph IJ Printer.It searches for available IJ printers on the network using the
Search
method and connects to the first printer found.The program then retrieves device information, such as version, status, errors, device info, and configuration settings, and displays them.
It lists the label files stored on the printer.
using IJAPI;
namespace IJ_DemoApp;
public class Program
{
private static readonly IJ _api = new();
public static async Task Main(string[] args)
{
//Search IJ printers on the network
var foundIJPrinters = await _api.Search();
foreach (var printer in foundIJPrinters)
{
//connect to printer
var ij = _api.Connect(printer);
if (ij.IsConnected)
{
Console.WriteLine($@"labels of {ij.Model} printer: {ij.IP} {new string('-', 70)}");
foreach (var labelName in ij.Labels) Console.WriteLine($"Label: {labelName}");
//Read device configuration
Console.WriteLine(new string('-', 40));
foreach (var configKey in ij.RequestConfigurationKeys())
Console.WriteLine($"configKey: {configKey} value: {ij.RequestConfigurationString(configKey)}");
//Read device infos
Console.WriteLine(new string('-', 40));
foreach (var deviceInfokey in ij.RequestDeviceConfigurationKeys())
Console.WriteLine(
$"deviceInfokey: {deviceInfokey} value: {ij.RequestDeviceConfigurationString(deviceInfokey)}");
do
{
//Read current status
Console.WriteLine($"Status: {ij.Status}");
Console.WriteLine($"LabelName: {ij.LabelName}");
Console.WriteLine($"PrintCount: {ij.PrintCount}");
Console.WriteLine($"EncoderSpeed: {ij.EncoderSpeed}");
Console.WriteLine($"ProductDetected: {ij.ProductDetected}");
Console.WriteLine();
Console.WriteLine("Press enter to continue, Escape to Quit");
Console.WriteLine();
} while (Console.ReadKey(true).Key != ConsoleKey.Escape);
}
else
{
Console.WriteLine("Not connected: " + ij.IP);
}
}
Console.WriteLine();
Console.WriteLine("Press enter to continue");
Console.ReadLine();
}
}
Download and upload a label
var labelName = "label.next" // "label.prd"
var desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var labelFile = Path.Combine(desktopPath, labelName);
//download a label
var labelContent = ij.GetLabel(labelName, true); //embedding the referenced bitmaps
File.WriteAllText(labelFile, labelContent);
//upload a label. The embedded bitmaps are restored
ij.UploadLabel(labelFile);
License
This project follows the licensing terms of the Diagraph-IJAPI library. Be sure to review the license associated with the library for details.
If you encounter any issues or have questions, please refer to the library's documentation or contact the library's support resources.
Enjoy working with your Diagraph IJ Printer!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net is compatible. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Api update