AbobosSoftware / cordova-plugin-brother-label-printer

Cordova and Capacitor plugin for Bother Label Printers
MIT License
10 stars 16 forks source link

Styling #56

Closed cpgb85 closed 1 year ago

cpgb85 commented 1 year ago

What's the best method for printing labels out in pixels? I have a dk-2205 label right now, I want to have a label designer on my website, but there is no clear cut method for converting pixels to whatever this is measured in.

arcadius commented 1 year ago

Your can use HTML5 canvas. then let dataUrl: string = canvas.toDataURL('image/png'); you need to extract the base64 encoded image from the dataUrl Then send that to the printer via the SDK

arcadius commented 1 year ago

BTW: This is not an issue related to this SDK, so, closing this

cpgb85 commented 1 year ago

Yes this is what I currently do. But what about height and width of the label? How is this taken into consideration? This does seem related to the SDK because there is no way to specify heights and widths to make things fit.

Regardless, even if this is so, where do i ask for help?

On Mon, Jan 30, 2023, 11:05 AM Arcadius Ahouansou @.***> wrote:

Your can use HTML5 canvas. then let dataUrl: string = canvas.toDataURL('image/png'); you need to extract the base64 encoded image from the dataUrl Then send that to the printer via the SDK

— Reply to this email directly, view it on GitHub https://github.com/AbobosSoftware/cordova-plugin-brother-label-printer/issues/56#issuecomment-1408992280, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFFPXTMA3FEDS36ICKBCAGLWU7YE3ANCNFSM6AAAAAAULLUY5A . You are receiving this because you authored the thread.Message ID: <AbobosSoftware/cordova-plugin-brother-label-printer/issues/56/1408992280@ github.com>

robr2112 commented 1 year ago

Assuming this plugin is still using v3 APIs, and you’re using iOS SDK, there is a setting in the BRPtouchPrintInfo that controls scaling. I recall it’s called nPrintMode. This setting controls how sdk “scale” the image (or pdf) relative to the current paper size. By default it should be “fit to page”, which scales to the printable area (paper minus margins), and it preserves image aspect ratio by scaling length and width by same amount. The “original” mode does not scale at all (EDIT: WRONG: but clips at boundary of printable area, CORRECT: attempting to print results in error if image exceeds the printable area in either dimension). The “fit paper” option scales (with aspect ratio) to fit the paper instead of P/A, which trims the boundary of your image. Usually default Fit Page is best mode to use in general.

We STRONGLY recommend that you create an image that is close to same size as the paper, to avoid print quality issues caused by scaling.

If you are working in pixels, you need to consider the resolution of the printer to determine the “actual size” (original size) of your image. Here is online user manual, with v3 ios reference to the print settings class: https://support.brother.com/g/s/es/htmldoc/mobilesdk/reference/ios/brptouchprintinfo.html