Hi Aurora,
I'm printing Barcode labels directly to the printer. I define a template
with a simple Texteditor containing some placeholders (#TXT#, #EAN#, ..)
which I replace before printing:
Franz
// Build finished label
PROCEDURE PrintLabel( cPrinter AS STRING,;
cLabel AS STRING,;
cTxt AS STRING,;
cArtnr AS STRING,;
cEan AS STRING,;
nVkp AS FLOAT)
LOCAL cVal AS STRING
// Read template
cVal := MemoRead(cLabel)
// Replace placeholders
cVal := StrTran(cVal, "#TXT#", AllTrim(cTxt))
cVal := StrTran(cVal, "#ARTNR#", AllTrim(cArtnr))
cVal := StrTran(cVal, "#EAN#", AllTrim(cEan))
cVal := StrTran(cVal, "#VKP#", Str(nVkp,7,2))
// Print to windows printer
WriteData2Printer(cPrinter, cVal)
RETURN
// Print function I got somethere from usergroup
FUNCTION WriteData2Printer (cPrinter AS STRING,;
cData AS STRING) AS LOGIC PASCAL
LOCAL lResult AS LOGIC
LOCAL hPrinter AS PTR
LOCAL pszPrinter AS PSZ
LOCAL pBuffer AS PTR
LOCAL dwWritten AS DWORD
LOCAL pDocInfo IS _winDoc_Info_1
LOCAL pPtrDflts IS _WINPRINTER_DEFAULTS
lResult := FALSE
pszPrinter := StringAlloc(cPrinter + _CHR(0))
IF OpenPrinter(pszPrinter, @hPrinter, @pPtrDflts ) // NULL
pBuffer := StringAlloc(cData + _CHR(0))
pDocInfo.pDocName := String2Psz("PrinterSpooler Document")
pDocInfo.pOutPutFile := NULL_PSZ // String2Psz (NULL_STRING)
pDocInfo.pDatatype := String2Psz ("RAW")
IF StartDocPrinter(hPrinter, 1, @pDocInfo) <> 0
IF WritePrinter(hPrinter, pBuffer, SLen(cData), @dwWritten)
IF dwWritten == SLen(cData)
lResult := TRUE
ENDIF
ELSE
dwWritten := GetLastError()
ENDIF
EndDocPrinter(hPrinter)
ELSE
dwWritten := GetLastError()
ENDIF
ClosePrinter(hPrinter)
MemFree(pBuffer)
ELSE
dwWritten := GetLastError()
ENDIF
MemFree(pszPrinter)
RETURN lResult
Am 15.10.2021 um 16:04 schrieb aurora baccio:
good morning
I need to create a label to print on a dymo 450.
Currently I use word, but it becomes more and more complex when printing.
How can I create a text file for the dymo to print? The size of the label to be printed is three centimetres wide by five centimetres high.
I was able to find the horizontal x five cm labels, but I can't create the file to send to the dymo printer.
thanks
Aurora Baccio
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)