since Paul recommended Zint I had another look at their GitHub repo https://github.com/zint/zint and there have been recent updated and building binaries is easy with msys2
fbFrog translates the zint.h with no problem
zint.bi
#pragma once
extern "C"
#define ZINT_H
#inclib "zint"
type zint_vector_rect
x as single
y as single
height as single
width as single
colour as long
next as zint_vector_rect ptr
end type
type zint_vector_hexagon
x as single
y as single
diameter as single
rotation as long
next as zint_vector_hexagon ptr
end type
type zint_vector_string
x as single
y as single
fsize as single
width as single
length as long
rotation as long
halign as long
text as ubyte ptr
next as zint_vector_string ptr
end type
type zint_vector_circle
x as single
y as single
diameter as single
width as single
colour as long
next as zint_vector_circle ptr
end type
type zint_vector
width as single
height as single
rectangles as zint_vector_rect ptr
hexagons as zint_vector_hexagon ptr
strings as zint_vector_string ptr
circles as zint_vector_circle ptr
end type
type zint_structapp
index as long
count as long
id as zstring * 32
end type
type zint_symbol
symbology as long
height as single
scale as single
whitespace_width as long
whitespace_height as long
border_width as long
output_options as long
fgcolour as zstring * 10
bgcolour as zstring * 10
fgcolor as zstring ptr
bgcolor as zstring ptr
outfile as zstring * 256
primary as zstring * 128
option_1 as long
option_2 as long
option_3 as long
show_hrt as long
fontsize as long
input_mode as long
eci as long
dot_size as single
guard_descent as single
structapp as zint_structapp
warn_level as long
debug as long
text(0 to 127) as ubyte
rows as long
width as long
encoded_data(0 to 199, 0 to 143) as ubyte
row_height(0 to 199) as single
errtxt as zstring * 100
bitmap as ubyte ptr
bitmap_width as long
bitmap_height as long
alphamap as ubyte ptr
bitmap_byte_length as ulong
vector as zint_vector ptr
end type
type zint_seg
source as ubyte ptr
length as long
eci as long
end type
const BARCODE_CODE11 = 1
const BARCODE_C25STANDARD = 2
const BARCODE_C25MATRIX = 2
const BARCODE_C25INTER = 3
const BARCODE_C25IATA = 4
const BARCODE_C25LOGIC = 6
const BARCODE_C25IND = 7
const BARCODE_CODE39 = 8
const BARCODE_EXCODE39 = 9
const BARCODE_EANX = 13
const BARCODE_EANX_CHK = 14
const BARCODE_GS1_128 = 16
const BARCODE_EAN128 = 16
const BARCODE_CODABAR = 18
const BARCODE_CODE128 = 20
const BARCODE_DPLEIT = 21
const BARCODE_DPIDENT = 22
const BARCODE_CODE16K = 23
const BARCODE_CODE49 = 24
const BARCODE_CODE93 = 25
const BARCODE_FLAT = 28
const BARCODE_DBAR_OMN = 29
const BARCODE_RSS14 = 29
const BARCODE_DBAR_LTD = 30
const BARCODE_RSS_LTD = 30
const BARCODE_DBAR_EXP = 31
const BARCODE_RSS_EXP = 31
const BARCODE_TELEPEN = 32
const BARCODE_UPCA = 34
const BARCODE_UPCA_CHK = 35
const BARCODE_UPCE = 37
const BARCODE_UPCE_CHK = 38
const BARCODE_POSTNET = 40
const BARCODE_MSI_PLESSEY = 47
const BARCODE_FIM = 49
const BARCODE_LOGMARS = 50
const BARCODE_PHARMA = 51
const BARCODE_PZN = 52
const BARCODE_PHARMA_TWO = 53
const BARCODE_CEPNET = 54
const BARCODE_PDF417 = 55
const BARCODE_PDF417COMP = 56
const BARCODE_PDF417TRUNC = 56
const BARCODE_MAXICODE = 57
const BARCODE_QRCODE = 58
const BARCODE_CODE128B = 60
const BARCODE_AUSPOST = 63
const BARCODE_AUSREPLY = 66
const BARCODE_AUSROUTE = 67
const BARCODE_AUSREDIRECT = 68
const BARCODE_ISBNX = 69
const BARCODE_RM4SCC = 70
const BARCODE_DATAMATRIX = 71
const BARCODE_EAN14 = 72
const BARCODE_VIN = 73
const BARCODE_CODABLOCKF = 74
const BARCODE_NVE18 = 75
const BARCODE_JAPANPOST = 76
const BARCODE_KOREAPOST = 77
const BARCODE_DBAR_STK = 79
const BARCODE_RSS14STACK = 79
const BARCODE_DBAR_OMNSTK = 80
const BARCODE_RSS14STACK_OMNI = 80
const BARCODE_DBAR_EXPSTK = 81
const BARCODE_RSS_EXPSTACK = 81
const BARCODE_PLANET = 82
const BARCODE_MICROPDF417 = 84
const BARCODE_USPS_IMAIL = 85
const BARCODE_ONECODE = 85
const BARCODE_PLESSEY = 86
const BARCODE_TELEPEN_NUM = 87
const BARCODE_ITF14 = 89
const BARCODE_KIX = 90
const BARCODE_AZTEC = 92
const BARCODE_DAFT = 93
const BARCODE_DPD = 96
const BARCODE_MICROQR = 97
const BARCODE_HIBC_128 = 98
const BARCODE_HIBC_39 = 99
const BARCODE_HIBC_DM = 102
const BARCODE_HIBC_QR = 104
const BARCODE_HIBC_PDF = 106
const BARCODE_HIBC_MICPDF = 108
const BARCODE_HIBC_BLOCKF = 110
const BARCODE_HIBC_AZTEC = 112
const BARCODE_DOTCODE = 115
const BARCODE_HANXIN = 116
const BARCODE_MAILMARK = 121
const BARCODE_AZRUNE = 128
const BARCODE_CODE32 = 129
const BARCODE_EANX_CC = 130
const BARCODE_GS1_128_CC = 131
const BARCODE_EAN128_CC = 131
const BARCODE_DBAR_OMN_CC = 132
const BARCODE_RSS14_CC = 132
const BARCODE_DBAR_LTD_CC = 133
const BARCODE_RSS_LTD_CC = 133
const BARCODE_DBAR_EXP_CC = 134
const BARCODE_RSS_EXP_CC = 134
const BARCODE_UPCA_CC = 135
const BARCODE_UPCE_CC = 136
const BARCODE_DBAR_STK_CC = 137
const BARCODE_RSS14STACK_CC = 137
const BARCODE_DBAR_OMNSTK_CC = 138
const BARCODE_RSS14_OMNI_CC = 138
const BARCODE_DBAR_EXPSTK_CC = 139
const BARCODE_RSS_EXPSTACK_CC = 139
const BARCODE_CHANNEL = 140
const BARCODE_CODEONE = 141
const BARCODE_GRIDMATRIX = 142
const BARCODE_UPNQR = 143
const BARCODE_ULTRA = 144
const BARCODE_RMQR = 145
const BARCODE_BC412 = 146
const BARCODE_LAST = 146
const BARCODE_NO_ASCII = &h0001
const BARCODE_BIND = &h0002
const BARCODE_BOX = &h0004
const BARCODE_STDOUT = &h0008
const READER_INIT = &h0010
const SMALL_TEXT = &h0020
const BOLD_TEXT = &h0040
const CMYK_COLOUR = &h0080
const BARCODE_DOTTY_MODE = &h0100
const GS1_GS_SEPARATOR = &h0200
const OUT_BUFFER_INTERMEDIATE = &h0400
const BARCODE_QUIET_ZONES = &h0800
const BARCODE_NO_QUIET_ZONES = &h1000
const COMPLIANT_HEIGHT = &h2000
const DATA_MODE = 0
const UNICODE_MODE = 1
const GS1_MODE = 2
const ESCAPE_MODE = &h0008
const GS1PARENS_MODE = &h0010
const GS1NOCHECK_MODE = &h0020
const HEIGHTPERROW_MODE = &h0040
const FAST_MODE = &h0080
const DM_SQUARE = 100
const DM_DMRE = 101
const ZINT_FULL_MULTIBYTE = 200
const ULTRA_COMPRESSION = 128
const ZINT_WARN_INVALID_OPTION = 2
const ZINT_WARN_USES_ECI = 3
const ZINT_WARN_NONCOMPLIANT = 4
const ZINT_ERROR = 5
const ZINT_ERROR_TOO_LONG = 5
const ZINT_ERROR_INVALID_DATA = 6
const ZINT_ERROR_INVALID_CHECK = 7
const ZINT_ERROR_INVALID_OPTION = 8
const ZINT_ERROR_ENCODING_PROBLEM = 9
const ZINT_ERROR_FILE_ACCESS = 10
const ZINT_ERROR_MEMORY = 11
const ZINT_ERROR_FILE_WRITE = 12
const ZINT_ERROR_USES_ECI = 13
const ZINT_ERROR_NONCOMPLIANT = 14
const WARN_DEFAULT = 0
const WARN_FAIL_ALL = 2
const ZINT_CAP_HRT = &h0001
const ZINT_CAP_STACKABLE = &h0002
const ZINT_CAP_EXTENDABLE = &h0004
const ZINT_CAP_COMPOSITE = &h0008
const ZINT_CAP_ECI = &h0010
const ZINT_CAP_GS1 = &h0020
const ZINT_CAP_DOTTY = &h0040
const ZINT_CAP_QUIET_ZONES = &h0080
const ZINT_CAP_FIXED_RATIO = &h0100
const ZINT_CAP_READER_INIT = &h0200
const ZINT_CAP_FULL_MULTIBYTE = &h0400
const ZINT_CAP_MASK = &h0800
const ZINT_CAP_STRUCTAPP = &h1000
const ZINT_CAP_COMPLIANT_HEIGHT = &h2000
const ZINT_MAX_DATA_LEN = 17400
const ZINT_MAX_SEG_COUNT = 256
const ZINT_DEBUG_PRINT = &h0001
const ZINT_DEBUG_TEST = &h0002
'' TODO: # define ZINT_EXTERN extern
declare function ZBarcode_Create() as zint_symbol ptr
declare sub ZBarcode_Clear(byval symbol as zint_symbol ptr)
declare sub ZBarcode_Delete(byval symbol as zint_symbol ptr)
declare function ZBarcode_Encode(byval symbol as zint_symbol ptr, byval source as const ubyte ptr, byval length as long) as long
declare function ZBarcode_Encode_Segs(byval symbol as zint_symbol ptr, byval segs as const zint_seg ptr, byval seg_count as const long) as long
declare function ZBarcode_Encode_File(byval symbol as zint_symbol ptr, byval filename as const zstring ptr) as long
declare function ZBarcode_Print(byval symbol as zint_symbol ptr, byval rotate_angle as long) as long
'declare function ZBarcode_Encode_and_Print(byval symbol as zint_symbol ptr, byval source as const ubyte ptr, byval length as long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_and_Print(byval symbol as zint_symbol ptr, byval source as const zstring ptr, byval length as long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_Segs_and_Print(byval symbol as zint_symbol ptr, byval segs as const zint_seg ptr, byval seg_count as const long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_File_and_Print(byval symbol as zint_symbol ptr, byval filename as const zstring ptr, byval rotate_angle as long) as long
declare function ZBarcode_Buffer(byval symbol as zint_symbol ptr, byval rotate_angle as long) as long
declare function ZBarcode_Encode_and_Buffer(byval symbol as zint_symbol ptr, byval source as const ubyte ptr, byval length as long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_Segs_and_Buffer(byval symbol as zint_symbol ptr, byval segs as const zint_seg ptr, byval seg_count as const long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_File_and_Buffer(byval symbol as zint_symbol ptr, byval filename as const zstring ptr, byval rotate_angle as long) as long
declare function ZBarcode_Buffer_Vector(byval symbol as zint_symbol ptr, byval rotate_angle as long) as long
declare function ZBarcode_Encode_and_Buffer_Vector(byval symbol as zint_symbol ptr, byval source as const ubyte ptr, byval length as long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_Segs_and_Buffer_Vector(byval symbol as zint_symbol ptr, byval segs as const zint_seg ptr, byval seg_count as const long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_File_and_Buffer_Vector(byval symbol as zint_symbol ptr, byval filename as const zstring ptr, byval rotate_angle as long) as long
declare function ZBarcode_ValidID(byval symbol_id as long) as long
declare function ZBarcode_BarcodeName(byval symbol_id as long, byval name as zstring ptr) as long
declare function ZBarcode_Cap(byval symbol_id as long, byval cap_flag as ulong) as ulong
declare function ZBarcode_Version() as long
end extern
--edit-- I changed ubyte ptr to zstring ptr in function ZBarcode_Encode_and_Print
png of the tiny test
a tiny test
#include "zint.bi"
dim as zint_symbol ptr my_symbol
my_symbol = ZBarcode_Create()
ZBarcode_Encode_and_Print(my_symbol, "1010101", 0, 0)
ZBarcode_Delete(my_symbol)
tiny test2
#include "zint.bi"
dim as zint_symbol ptr my_symbol
my_symbol = ZBarcode_Create()
my_symbol->symbology=BARCODE_QRCODE
my_symbol->scale=8
my_symbol->outfile="C:\Users\Admin\Desktop\PlanetSquires.png"
ZBarcode_Encode_and_Print(my_symbol, "PlanetSquires", 0, 0)
ZBarcode_Delete(my_symbol)
Wow, that's awesome Johan! I bet that Peter will be VERY happy with what you've done. Thanks for taking the time to create this.
I am going to try to separate your posts out into a standalone thread so that it will be easier to search for and find in the future.
here's the Qt5 GUI front end, the 7zip compressed file is almost 25 MB and the extracted folder is about 100 MB https://drive.google.com/file/d/1saN4bmbDl3QJG2jqV3swD7BshpgCU8aZ/view?usp=sharing
you need to launch it by running the file gui-frontend.bat because it needs to setup the environment variable QT_QPA_PLATFORM_PLUGIN_PATH to the plugins\platforms folder without which the program won't run
You guys are amazing!
Thank you.
Regards, Peter
Wow. This works amazingly well and fast too!
You have solved years of bad borcodes for me!
Thank you very much.
Regards, Peter
Hi Johan
Your code made the world of a difference.
I have decided to only go this route as this is flawless.
Tested every symbology imaginable.
The only thing left to do is to keep the image in memory, and not as a file and print individual labels. From some other posts I believe this can be done.
That placement on labels in Winfbx I have not attempted yet.
But marvellous work mate.
Regards, Peter
I am glad that it worked out for you :)
Hi Johan
Have you worked with the ZINT option to create the barcode in memory instead of saving it?
ZBarcode_Encode_and_Buffer
I was hoping to see how one would access that PTR and print it directly from memory.
-Regards, Peter
hello Petrus Vorster
the zint.bi was generated by fbfrog https://github.com/dkl/fbfrog and I don't remember whether I had to edit or complete any todo's except that in the function ZBarcode_Encode_and_Print I replaced byval source as const ubyte ptr with byval source as const zstring ptr
the change was made so as to be able to pass a string instead of a pointer to an array of bytes, this was done to simplify the tiny examples that I presented, but I did not do the replacement on the rest of the functions because I didn't know how those functions would be called
'declare function ZBarcode_Encode_and_Print(byval symbol as zint_symbol ptr, byval source as const ubyte ptr, byval length as long, byval rotate_angle as long) as long
declare function ZBarcode_Encode_and_Print(byval symbol as zint_symbol ptr, byval source as const zstring ptr, byval length as long, byval rotate_angle as long) as long
anyway, if I do the replacement to the ZBarcode_Encode_and_Buffer function so that I can pass a string then I thought that this example would work
#include "zint.bi"
#include "Afx/CMemBmp.inc"
dim as zint_symbol ptr my_symbol
my_symbol = ZBarcode_Create()
my_symbol->symbology=BARCODE_QRCODE
my_symbol->scale=8
? ZBarcode_Encode_and_Buffer(my_symbol, "PlanetSquires", 0, 0)
? "my_symbol->bitmap_width = ";my_symbol->bitmap_width
? "my_symbol->bitmap_height = ";my_symbol->bitmap_height
? AfxGdipPrintHBITMAP (my_symbol->bitmap)
ZBarcode_Delete(my_symbol)
but AfxGdipPrintHBITMAP (my_symbol->bitmap) returns false and nothing is printed
hello all :)
I just had a look at Rod Macia's code https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/797435-zint-barcode-generator
and he converts the image data to a bitmap, we would need to that in FB also, am totally ignorant on the subject but will do some searching
Thanks Johan,
I just started working on this also based on your code and DLL download.
I'll see if I can get it all working and then I'll post back here
Fellows, I know I have said it before, but honestly, the kind of people you find on this site are impossible to find elsewhere.
The support and dedication you give to complete strangers across the globe is unmatched on the planet.
I would have been stuck at Vb6 for eternity if Paul with Firefly did not came across my path, and the rest of the team that came along until now, are genuinely remarkable people.
I am so thankful for meeting with all of you!
-Peter
You're welcome Peter :-)
I have the code working now based on what Johan posted. I was able to easily use Jose's CMemBmp class to create the necessary bitmap handle and print it. The next step would be to make a copy of the AfxGdipPrintHBITMAP function and modify it to handle any incoming printer name and also location for print output.
#include "zint.bi"
#include once "Afx/AfxGdiplus.inc"
#include once "Afx/CMemBmp.inc"
'' ************************
'' MAIN ENTRY POINT
'' ************************
dim as zint_symbol ptr pSymbol = ZBarcode_Create()
pSymbol->symbology = BARCODE_QRCODE
pSymbol->scale = 8
? ZBarcode_Encode_and_Buffer(pSymbol, @"PlanetSquires", 0, 0)
? "my_symbol->bitmap_width = "; pSymbol->bitmap_width
? "my_symbol->bitmap_height = "; pSymbol->bitmap_height
dim as CMemBmp memBMP = CMemBmp( pSymbol->bitmap_width, pSymbol->bitmap_height )
dim as byte ptr pCol = pSymbol->bitmap
dim as long i = 0
for y as long = 1 to pSymbol->bitmap_height
for x as long = 1 to pSymbol->bitmap_width
dim as COLORREF clr = BGR(pCol[i], pCol[i+1], pCol[i+2])
memBMP.SetPixel(x, y, clr)
i += 3
next
next
? AfxGdipPrintHBITMAP( memBMP.GethBmp )
ZBarcode_Delete(pSymbol)
sleep
Incredible.
It scans perfectly, even from the screen using a Zebra DS22.
It defaults to my Adobe printer and the barcode works.
Next step is that label printer!
Great stuff.
-Peter
Hi Peter,
Here is modified code of Jose's bitmap printing routine that now allows you to specify the printer (wszPrinterName) and output location of the bitmap (xpos, ypos).
It seems to work okay with my virtual PDF printer. Hopefully it will work okay with your actual label printer.
#include "zint.bi"
#include once "Afx/AfxGdiplus.inc"
#include once "Afx/CMemBmp.inc"
' ========================================================================================
' Retrieves the name of the default printer.
' ========================================================================================
function GetDefaultPrinterName() AS CWSTR
dim buffer as wstring * MAX_PATH
GetProfileStringW "WINDOWS", "DEVICE", "", buffer, sizeof(buffer)
return AfxStrParse(buffer, 1, ",")
end function
' ========================================================================================
' ========================================================================================
' Print the label to the specified printer and location.
' ========================================================================================
function PrintLabel( _
byval hbmp as HBITMAP, _
byval xpos as single, _
byval ypos as single, _
byref wszPrinterName as wstring _
) as boolean
' // Initialize Gdiplus
dim token as ULONG_PTR = AfxGdipInit
if token = null then exit function
dim hPrinter as HANDLE
dim pbufferDoc as ubyte ptr
dim pBitmap as GpBitmap ptr
dim pGraphics as GpGraphics ptr
if wszPrinterName = "" then exit function
' // Note: Using a DO... LOOP, with an EXIT DO before LOOP, to avoid the use of GOTO.
do
' // Open the printer
if OpenPrinterW(wszPrinterName, @hPrinter, null) = 0 then exit do
' // Allocate a buffer of the correct size
dim dwNeeded as DWORD = DocumentPropertiesW(null, hPrinter, wszPrinterName, null, null, 0)
pbufferDoc = CAllocate(1, dwNeeded)
' // Retrieve the printer configuration data
dim nRet as long = DocumentPropertiesW(null, hPrinter, wszPrinterName, cast(PDEVMODEW, pbufferDoc), null, DM_OUT_BUFFER)
if nRet <> IDOK then exit do
' // cast it to a DEVMODEW structure
dim pDevMode as DEVMODEW ptr = cast(DEVMODEW ptr, pbufferDoc)
' // Create a device context for the printer
dim hDC as .HDC = CreateDCW(wszPrinterName, wszPrinterName, null, pDevMode)
if hDC = null then exit do
' // Create a graphics object from the printer DC
GdipCreateFromHDC(hDC, @pGraphics)
if pGraphics = null then exit do
' // Create a Bitmap object from an HBITMAP
GdipCreateBitmapFromHBITMAP(hbmp, null, @pBitmap)
if pBitmap = null then exit do
' // Print the bitmap
dim di as DOCINFOW
dim wszDocName as wstring * 260 = "Printing bitmap"
di.cbSize = sizeof(DOCINFOW)
di.lpszDocName = @wszDocName
dim hr as long = StartDocW(hDC, @di)
if hr <= 0 then exit do
if StartPage(hDC) then
' // Draw the image
GdipDrawImage(pGraphics, cast(GpImage ptr, pBitmap), xPos, yPos)
EndPage(hDC)
end if
EndDoc(hDC)
function = true
exit do
loop
if pBitmap then GdipDisposeImage(cast(GpImage ptr, pBitmap))
if pGraphics then GdipDeleteGraphics(pGraphics)
' // Finished with the printer
if hPrinter then ClosePrinter(hPrinter)
' // Cleanup
if pbufferDoc then Delete(pbufferDoc)
' // Shutdown Gdiplus
GdiplusShutdown token
end function
'' ************************
'' MAIN ENTRY POINT
'' ************************
dim as zint_symbol ptr pSymbol = ZBarcode_Create()
pSymbol->symbology = BARCODE_QRCODE
pSymbol->scale = 8
? ZBarcode_Encode_and_Buffer(pSymbol, @"PlanetSquires", 0, 0)
? "my_symbol->bitmap_width = "; pSymbol->bitmap_width
? "my_symbol->bitmap_height = "; pSymbol->bitmap_height
dim as CMemBmp memBMP = CMemBmp( pSymbol->bitmap_width, pSymbol->bitmap_height )
dim as byte ptr pCol = pSymbol->bitmap
dim as long i = 0
for y as long = 1 to pSymbol->bitmap_height
for x as long = 1 to pSymbol->bitmap_width
dim as COLORREF clr = BGR(pCol[i], pCol[i+1], pCol[i+2])
memBMP.SetPixel(x, y, clr)
i += 3
next
next
dim as wstring * 260 wszPrinterName = GetDefaultPrinterName()
? PrintLabel( memBMP.GethBmp, 100, 200, wszPrinterName )
ZBarcode_Delete(pSymbol)
sleep
WOW
Printing in Freebasic is miles above my paygrade.
I dont even know how to add or place text here.
Xprint made life a breeze.
I assume one cannot combine this with your cprintpreview?
LOL, I cannot even see where the bitmap is being moved and placed. :o
I will give this a shot tonight, thank you.
-Peter
Printing in FB (well, the Windows version of FB) is done using direct Win32 api calls. You can see that in the code. Basically, query the defined printer for its capabilities in order to create an off screen bitmap where you construct your text and graphics and then call api functions to actually output it to the printer.
StartDocW
StartPage
GdipDrawImage
EndPage
EndDoc
You could use any of the GDI+ functions to output to that bitmap such as GdipDrawString to include text with the label.
Quote from: Petrus Vorster on June 14, 2023, 02:34:09 AMI assume one cannot combine this with your cprintpreview?
Not sure why you'd want an additional layer of abstraction when everything can be done without it.
QuoteLOL, I cannot even see where the bitmap is being moved and placed. :o
This is where the label bitmap is being moved into the GDI+ bitmap buffer that actually gets output to the printer:
' // Create a Bitmap object from an HBITMAP
GdipCreateBitmapFromHBITMAP(hbmp, null, @pBitmap)
if pBitmap = null then exit do
Maybe you should post some pseudo code of what it is you need to achieve and then I can write the necessary functions that will make it happen. For example, I assume that you will looping through and array of data, creating a label bitmap for each, adding additional text to the label(?), and then printing it to the physical printer.
For anyone lurking on this thread - Peter emailed me a picture of what the barcodes and other text on the label should look like. I'm putting together a simple class to handle his needs. Hopefully it will do what is needed.
Update: I emailed the code to Peter. Waiting now for him to try it out. Attached is what the sample code I sent him generates. One large barcode and two half height barcodes with a text heading of "Insured Parcel". Created using zint dll, GDI+, and a couple of Jose's AFX classes.
HI All
I would NEVER have managed without all the help.
The download link got blocked by the server, so I will check my home email tonight.
From this point on I just need to finish the rest of the tool to change the headers of the labels as required, and already did the tracking number & check digit creator.
Margins and so forth will be next.
If this works we could save millions. Why on earth they went with buying warehouses full of pre-printed labels are beyond me.
I will most definitely try this at home tonight!!!
-Regards, Peter
Hi All
Paul, what on earth would I have done without you?
You made it so simple! Classlabels.inc made it incredibly simple to use.
The label prints correctly, the barcodes scan correctly.
This is truly something everyone here that needs barcodes can use with great ease.
I am unable to express my gratitude, it is perfect.
Once I am done with the Tracking numbers loop I will post a video of it printing a number of individual labels.
Everyone here, I am in great debt with you!
-Peter
Wow!
The label looks better than I would have imagined!
So cool that everything is working well with the label and barcodes.
You are very welcome and I am happy that I was able to help you.
Many people over the years have helped me out immensely (Jose Roca, in particular), so being able to pay it forward gives me a good feeling.
Hi All
As promised. My project is nearly done.
I recorded the basic process using all the help I got from everyone here.
Johan Klassen, Paul Squires & José Roca, without you this would never have happened.
The example is on a small label printer, but this will run on a large industrial printer with plastic coatings and hi defenition printing.
So far, everything works, and its all due to you.
Once we seriously trial runs this in the warehouse I will update this post.
Regards,
Peter