Anmelden

View Full Version : ZPL2: Textfeld mit variabler Breite



AlexK
10-01-09, 13:06
Hallo Experten!
Nachdem jetzt mein Zebra läuft und ich die ersten Etiketten gedruckt habe, hänge ich nun an den Feinheiten und hoffe hier wieder auf Hilfe! :rolleyes:

Ich erstelle die Lables on-the-fly in meiner Webanwendung (ASP). Dazu habe ich mir ein Layout im ZebraDesigner gebastelt, dieses als PRN abgespeichert und verwende dies als Grundlage.

Das sieht dann ungefähr so aus:

^XA~TA000~JSN^LT0^MMT^MNW^MTT^PON^PMN^LH0,0^JMA^PR 6,6^MD10^JUS^LRN^CI0^XZ
^XA^LL0203
^PW406
^BY1,3,34^FT120,178^BCN,,Y,N
^FD##Barcodefeld##^FS
^FT22,30^A0N,28,28^FH\^FD##Firmenname##^FS
^FT22,70^A0N,28,28^FH\^FD##Stadt##^FS
^FT298,70^A0N,28,33^FH\^FD##Abteitlung##^FS
^FT22,122^A0N,28,24^FH\^FD##bli bla bub##^FS
^PQ1,0,1,Y^XZ
Die Felder mit ##TEXT## ersetze ich in der Webanwendung mit dem richtigen Text.
Das funktioniert auch, mein Problem ist nur, dass die Felder alle absolut positioniert sind und eine feste Größe haben, der Text, den ich einfüge, aber unterschiedlich lang sein kann.
Gibt es ein Textfeld, dessen Breite ich festlegen kann und in dem der Text, auch wenn er nicht die ganze Breite des Feldes benötigt, z.B. links ausgerichtet ist ohne das der Text auf die ganze Länge des Feldes gestreckt wird? (hab ich das verständlich rübergebracht??? :o )
Das Barcodefeld würde ich z.B. gerne auf die gesamte Breite des Etiketts ziehen, und der eigentliche Barcode wird zentriert in diesem Feld dargestellt... geht das???

Gruß, Alex

Fuerchau
12-01-09, 07:45
Dazu musst du dir mal das ZPL-Handbuch nehmen um die einzelnen Codes zu verstehen.
Es gibt keine festen Textfelder, der Inhalt zwischen ^FD und ^FS wird gedruckt.
Barcodes können nicht zentriert werden, wohl sog. Textblöcke:


^FB
Field Block

Description

The ^FB command allows you to print text into a defined block type format.

This command formats an


^FD or ^SN string into a block of text using the origin, font, and

rotation specified for the text string. The


^FB command also contains an automatic word-wrap

function.
Format


^FBa,b,c,d,e

This table identifies the parameters for this format:
Parameters Details
a


= width of text

block line (in
dots)
Accepted Values:


0 to the width of the label

Default Value:


0

If the value is less than font width or not specified, text does
not print.
b


= maximum

number of lines
in text block
Accepted Values:


1 to 9999

Default Value:


1

Text exceeding the maximum number of lines overwrites the
last line. Changing the font size automatically increases or
decreases the size of the block.
c


= add or delete

space between
lines (in dots)
Accepted Values:


-9999 to 9999

Default Value:


0

Numbers are considered to be positive unless preceded by a
minus sign. Positive values add space; negative values delete
space.
d


= text justification Accepted Values:

L =


left

C =


center

R =


right

J =


justified

Default Value:


L

If


J is used the last line is left-justified.

e


= hanging indent

(in dots) of the
second and
remaining lines
Accepted Values:


0 to 9999

Default Value:


0

Comments on the


^FB Command

This scheme can be used to facilitate special functions:
\& =


carriage return/line feed

\(*) =


soft hyphen (word break with a dash)

\\ =


backslash (\)

Item 1:


^CI13 must be selected to print a backslash (\).

Item 2:


If a soft hyphen escape sequence is placed near the end of a line, the hyphen is printed.

If it is not placed near the end of the line, it is ignored.
(*) = any alphanumeric character
• If a word is too long to print on one line by itself (and no soft hyphen is specified), a
hyphen is automatically placed in the word at the right edge of the block. The remainder
of the word is on the next line. The position of the hyphen depends on word length, not a
syllable boundary. Use a soft hyphen within a word to control where the hyphenation
occurs.
• Maximum data-string length is 3K, including control characters, carriage returns, and line
feeds.
• Normal carriage returns, line feeds, and


word spaces at line breaks are discarded.

• When using


^FT (Field Typeset), ^FT uses the baseline origin of the last possible line of

text. Increasing the font size causes the text block to increase in size from bottom to top.
This could cause a label to print past its top margin.
• When using


^FO (Field Origin), increasing the font size causes the text block to increase

in size from top to bottom.



^FS terminates an ^FB command. Each block requires its own ^FB command.

Example •


These are examples of how the ^FB command affects field data.

kitvb1
12-01-09, 11:12
Vielleicht hilft diese Dir.
http://newsolutions.de/forum-systemi-as400-i5-iseries/60468-post4.html

angelone
13-01-09, 15:20
es reicht übrigens wenn du nur

^XA

...Nutzdaten

^PQ1
^XZ

an den Drucker schickst.
Das Einmessen der Etikettenlänge und so Zeugs macht der selber.
Der braucht nur Infos was er drucken soll.
Die ganzen Parameter, die dir der Zebradesigner in den Header schreibt brauchste nicht.

Der ^LH0,0 Prameter ist noch ganz nett, um auf die schnelle einen Rand zu definieren.