Printing a string correctly

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Printing a string correctly

Post by AndyGable »

Hi Everyone

I was hoping someone could help me

I am at the moment working on migrating one of my Windows application to Gambas3

This application prints Labels on a Zebra LP2824 Printer (Networked - Also would like some help on how to print to the networked printer)

What it does it it will access a database field called SELDescription (this can be up to 125 chrs long) and it would split it so it will print correctly.

The label on the Printer has 5 lines of 25 chrs per line

what i need help with is how to go it so the label looks correct

Say I have this in the database "WAGG MEATY GOODNESS ADULT COMPLETE BEEF DINNER 12KG"

I need to print the label like

WAGG MEATY GOODNESS 
ADULT COMPLETE BEEF 
DINNER 12KG


NOT

WAGG MEATY GOODNESS AD


I have all the code I need to make the label print correctly I just need help in splitting the Database Field up so I can have full words on the lines (and use up to 5 lines if needed)

is someone could point me in the correct direction or even better is someone has some example code that would be great

Thank in advance
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Printing a string correctly

Post by cogier »

Check out the last post in this section A challenge for you. Also see if lpstat -p -d on the command line sees your printer.

EDIT 05/08/23
It would be helpful to know what size label you are wanting to print on. (e.g. 50x25mm)
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Printing a string correctly

Post by BruceSteers »

Yep we just had this same conversation.

There are a few methods mentioned from text adjusting to making a text image.

See here... viewtopic.php?t=1576
If at first you don't succeed , try doing something differently.
BruceS
Post Reply