SharpIpp

Internet Printing Protocol u C#-u

NuGet

PM> Install-Package SharpIpp · MIT · 50 zvezdica
Izvorni kod na GitHubu

C# implementacija Internet Printing Protocol-a/1.1 i delova CUPS-a 1.0. Štampa! I radi još svašta sa bilo kojim štampačem koji je na mreži.

Instalacija

Dostupno na nugetu

PM> Install-Package SharpIpp

Štampa

await using var stream = File.Open(@"c:\file.pdf", FileMode.Open);
var printerUri = new Uri("ipp://192.168.0.1:631");
var request = new PrintJobRequest
{
    PrinterUri = printer,
    Document = stream,
    JobName = "Test Job",
    IppAttributeFidelity = false,
    DocumentName = "Document Name",
    DocumentFormat = "application/octet-stream",
    DocumentNaturalLanguage = "en",
    MultipleDocumentHandling = MultipleDocumentHandling.SeparateDocumentsCollatedCopies,
    Copies = 1,
    Finishings = Finishings.None,
    PageRanges = new[] {new Range(1, 1)},
    Sides = Sides.OneSided,
    NumberUp = 1,
    OrientationRequested = Orientation.Portrait,
    PrinterResolution = new Resolution(600, 600, ResolutionUnit.DotsPerInch),
    PrintQuality = PrintQuality.Normal
};
var response = await client.PrintJobAsync(request);

Podržane operacije

IPP 1.1

CUPS 1.0

Sopstvene operacije

Metod CustomOperationAsync šalje štampaču zahtev koji ceo sastaviš sam.

var request = new IppRequestMessage
{
    RequestId = 1,
    IppOperation = (IppOperation)0x000A,
    Version = IppVersion.V11
};
request.OperationAttributes.AddRange(
    new []
    {
        new IppAttribute(Tag.Charset, "attributes-charset", "utf-8"),
        new IppAttribute(Tag.NaturalLanguage, "attributes-natural-language", "en"),
        new IppAttribute(Tag.NameWithoutLanguage, "requesting-user-name", "test"),
        new IppAttribute(Tag.Uri, "printer-uri", "ipp://localhost:631"),
        new IppAttribute(Tag.Integer, "job-id", 1),
    });
client.CustomOperationAsync("ipp://localhost:631", request);