Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Print Arabic Language #66

Open
manojssas opened this issue Feb 5, 2023 · 7 comments
Open

How to Print Arabic Language #66

manojssas opened this issue Feb 5, 2023 · 7 comments

Comments

@manojssas
Copy link

How can I print Arabic Language with Combination of English and Image?

@KevinGong2013
Copy link
Owner

KevinGong2013 commented Feb 6, 2023


public extension String {
    
    struct ArabicEncoding {
        public static let windowsArabic = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.windowsArabic.rawValue)))
    }
}

let receipt = Receipt(.🖨️58(String.ArabicEncoding.windowsArabic))

@manojssas
Copy link
Author

@KevinGong2013 When we using this. The Print comment Goes to blank [] block to print Like

extension String: ReceiptItem {

public func assemblePrintableData(_ profile: PrinterProfile) -> [UInt8] {
    guard let data = self.data(using: profile.encoding) else {
        return []
    }
    return Array<UInt8>(data) + Command.CursorPosition.lineFeed.value
}

}

I am using this code :

    let receipt = Receipt(.🖨️58(String.ArabicEncoding.windowsArabic))
            <<< "٥ حلواني"
            <<< KV("٢ برجر", "٢ برجر")

    if bluetoothPrinterManager.canPrint {
        bluetoothPrinterManager.write(Data(receipt.data))
    }

public extension String {

struct ArabicEncoding {
    public static let windowsArabic = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.windowsArabic.rawValue)))
}

}

But this is not working
Screenshot 2023-02-06 at 10 16 01 PM
Screenshot 2023-02-06 at 10 16 14 PM
Screenshot 2023-02-06 at 10 16 50 PM

@manojssas
Copy link
Author

@KevinGong2013 Can you check and update me?
Thanks

@KevinGong2013
Copy link
Owner

You should confirm your device support Arabic.

@manojssas
Copy link
Author

@KevinGong2013 Yes my device and printer both supports Arabic.
App was live from previous 5 Years on App store which has support for Arabic language.
And if we talk about the Printer. I am using X-Printer which supports Arabic language because in Android we are able to print Arabic language. Only iOS has issues.

@manojssas
Copy link
Author

@KevinGong2013 Hi is there any way to Print Arabic language.
Thanks in Advance

@manojssas
Copy link
Author

Dear @KevinGong2013
Have you got any idea like how to print Arabic language?
I do many changes inside Project but in Arabic mode this will print only blank.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants