DotNetToAllPrintersAdapter.ijc.global 1.0.11

dotnet add package DotNetToAllPrintersAdapter.ijc.global --version 1.0.11
                    
NuGet\Install-Package DotNetToAllPrintersAdapter.ijc.global -Version 1.0.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetToAllPrintersAdapter.ijc.global" Version="1.0.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetToAllPrintersAdapter.ijc.global" Version="1.0.11" />
                    
Directory.Packages.props
<PackageReference Include="DotNetToAllPrintersAdapter.ijc.global" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotNetToAllPrintersAdapter.ijc.global --version 1.0.11
                    
#r "nuget: DotNetToAllPrintersAdapter.ijc.global, 1.0.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=DotNetToAllPrintersAdapter.ijc.global&version=1.0.11
                    
Install DotNetToAllPrintersAdapter.ijc.global as a Cake Addin
#tool nuget:?package=DotNetToAllPrintersAdapter.ijc.global&version=1.0.11
                    
Install DotNetToAllPrintersAdapter.ijc.global as a Cake Tool

Usage

  1. u need to install the package from nuget org.
  2. inject the platfrom specific service to DI in the [startup].cs file and platform specific folder as follow in the [startup].cs file add the following partial method code:
    public static partial class [startup]
    {
        public static [App] [CreateApp]()
        {
            var builder = App.CreateBuilder();

            --- the following code what u need to add  ---
            RegisterPlatformServices(builder.Services);
            builder.Services.AddSingleton<PrinterService>();
            -- to here  --
          
         return builder.Build();
        }

       --the method definition here --
          static partial void RegisterPlatformServices(IServiceCollection services);
     }

then in the targeted platform we must include the code that will inject the platfrom's specific native code (device api) as follow for android:

```
public static partial class [startup]
{
    static partial void RegisterPlatformServices(IServiceCollection services)
    {
        services.AddSingleton<IPrinterService, AndroidPrinterService>();
    }
}
```

for iOS:

 ```
public static partial class [startup]
{
    static partial void RegisterPlatformServices(IServiceCollection services)
    {
        services.AddSingleton<IPrinterService, iOSPrinterService>();
    }
}
```

for windows:

```
public static partial class [startup]
{
    static partial void RegisterPlatformServices(IServiceCollection services)
    {
        services.AddSingleton<IPrinterService, WindowsPrinterService>();
    }
}
```

for tizen:

 ```
public static partial class [startup]
{
    static partial void RegisterPlatformServices(IServiceCollection services)
    {
        services.AddSingleton<IPrinterService, TizenPrinterService>();
    }
}
```

for mac:

```
public static partial class [startup]
{
    static partial void RegisterPlatformServices(IServiceCollection services)
    {
        services.AddSingleton<IPrinterService, MacPrinterService>();
    }
}
```
  1. use the service in your code as follow
printer = [App].[Current].Services.GetService<PrinterService>();// or the right way to access the container in ur app.

then populte the Printdata object with ur setting

var printData = new PrintData
            {
                Header = new List<List<string>> { new List<string> { "الكاشير: احمد ", "رقم الزبون:11" }, new List<string> { "رقم الفاتوره:523/2024", "رقم الطاوله:123" } },// this for header in arabic , u can add any number of rows in header
                Title ="انها مكتبه جيده",//this for title appear in the center of the page after the header
                Body = [ new List<List<string>> {  new List<string> { "اللغه العربيه لغه صعبه ولكنها جميله ما رأيك؟" }}, // this for body in arabic this will print only one column , u can add any number of columns in body
                 new List<List<string>>{new List<string>{ "الجواب الثالث", "الجواب الثاني","الجواب الاول" } ,new List<string>{ "الجواب  الثالث:محايد", "الجواب الثاني:لا","الجواب الاول:نعم"  } }],/ there will print 3 columns in body in 2 rows , u can add any number of rows,columns
                Footer = new List<string> { "السطر الثاني في الهامش",, "السطر الاول في الهامش" },//  u can add any number of lines in bottom margin
                Language = 1,// 1 for arabic ,2 for english and other languages
                TextSize = 35,
                LineHeight = 15,
                CenterImagePath = "C:\\Users\\Admin\\desktop\\Motto.png"// this motto picture appear in center of header if u add it,
            };

4.call the method:

printer.Print( printData, paperSize, MediaType, PrinterNameOrIp , PrinterMacAdress)

the parameters is printData: -object- the print data object that contain text data to be printed that previously populated, paperSize: -enum- targetted paper size mediaType: -enum- the transfer media used like usb,bluetooth..etc PrinterNameOrIp: -string- printer's name or ip if it use lan or usb [optional] PrinterMacAdress: -string- printer's mac address or ip if it use bluetooth [optional]

if u encounter an issue u can contact as at aaahmedwhf@gmail.com

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios18.0 is compatible.  net8.0-maccatalyst was computed.  net8.0-maccatalyst18.0 is compatible.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows10.0.19041 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.11 0 5/18/2025
1.0.10 30 5/17/2025
1.0.9 26 5/17/2025
1.0.8 30 5/17/2025
1.0.7 30 5/17/2025
1.0.6 33 5/17/2025
1.0.5 35 5/17/2025
1.0.4 30 5/17/2025
1.0.3 34 5/17/2025
1.0.2 35 5/17/2025
1.0.0 190 5/13/2025