function LabelToPage(pt: Tpoint;
index: Integer): TPoint;
const
PageLeft = 20;
PageTop = 30;
LabelWidth = 600;
//Original-Label-Masse
LabelHeight = 120;
begin
Result := Point(
pt.X + PageLeft + (
index mod 2) * LabelWidth,
pt.Y + PageTop + (
index div 2) * LabelHeight
);
end;
procedure Tlote.Button1Click(Sender: TObject);
const
ptArtikel: TPoint = (X: 0; Y: 0);
// Werte für DIN A4
ptFarbe: TPoint = (X: 150; Y: 0);
ptColumn2: TPoint = (X: 400; Y: 0);
ptOrder: TPoint = (X: 0; Y: 50);
ptCode: TPoint = (X: 125; Y: 32);
ptColumn0: TPoint = (X: 285; Y: 50);
ptColumn1: TPoint = (X: 415; Y: 50);
var
iRow, iLabel: Integer;
begin
deletetmppdf;
with printpdf1
do
begin
FileName:=gettemppathd+'
tmppdf'+Inttostr(random(5000))+'
.pdf';
PageWidth:=1224;
// Origanl-DIN A4
PageHeight:=1725;
// Origanl-DIN A4
BeginDoc;
Font.
Name:=poTimesBoldItalic;
Font.Size:=24;
//alt 24
end;
iLabel := 0;
with StringGrid1, printpdf1
do
for iRow := 0
to 15
do
if Trim(Cells[1, iRow+1]) <> '
'
then
begin
with LabelToPage(ptArtikel, iLabel)
do
TextOut(X, Y, '
Artigo: ' + lote.Artikel.Text);
with LabelToPage(ptFarbe, iLabel)
do
TextOut(X, Y, '
Côr: ' + Cells[3, FixedRows + iRow]);
//TextOut(X, Y, 'Côr: ' + lote.Farbe.Text); //von DB
with LabelToPage(ptColumn2, iLabel)
do
TextOut(X, Y, '
Tam.: ' + Cells[2, FixedRows + iRow]);
with LabelToPage(ptOrder, iLabel)
do
TextOut(X, Y,'
N.P.: '+lote.order.text);
with LabelToPage(ptCode, iLabel)
do
pdfcodedrucken(X, Y, lote.Order.Text, False);
with LabelToPage(ptColumn0, iLabel)
do
TextOut(X, Y, '
N°./Lo: ' + Cells[0, FixedRows + iRow]);
with LabelToPage(ptColumn1, iLabel)
do
TextOut(X, Y, '
Peç/Lo: ' + Cells[1, FixedRows + iRow]);
Inc(iLabel);
end;
with printpdf1
do
begin
EndDoc;
end;
ShellExecute(Application.Handle, '
open', PChar(printpdf1.FileName),
nil,
nil, SW_NORMAL);
end;