Hi, I'm working on a project that require filling forms.
Every field has  (x,y,width,height) dimension and
ui=(barcode,texEdit) type (textEdit has some attributes too)
I wrote this

%--------------
\unprotect
\definelayer[BackLayer]%
\setupbackgrounds[page][background={BackLayer}]

\setuplayout[topspace=0pt,backspace=0pt,margin=0pt,leftmargin=0pt,location=middle,
rightmargin=0pt,header=0pt,footer=0pt,top=0pt,bottom=0pt,
leftedge=0pt,rightedge=0pt,headerdistance=0pt,footerdistance=0pt,
topdistance=0pt,leftmargindistance=0pt,rightmargindistance=0pt,
leftedgedistance=0pt,rightedgedistance=0pt,width=fit,height=fit]

\def\BarcodeThreeOfNine#1{#1} %% todo....

\def\Field[#1]{%
\bgroup
\getparameters[!!][#1]%% collect key/val
%
%
%%%% textEdit
\doifsamestring{\!!ui}{textEdit}{% text field
\setlayer[BackLayer][x=\!!x,y=\!!y ,location=br]{%
[EMAIL PROTECTED] collect textEdit attributes
[EMAIL PROTECTED] collect para attributes
\ruledvbox to \!!h{\hsize=\!!w %
\vss
[EMAIL PROTECTED] single line
[EMAIL PROTECTED]
  \hbox to \!!w {\getvalue\s!dummy \vphantom{K}\getvalue\!!name \hss}%
 }%
[EMAIL PROTECTED]
  \hbox to \!!w {\getvalue\s!dummy \vphantom{K} \getvalue\!!name \hss}%
}%
[EMAIL PROTECTED]
 \hbox to \!!w {\hss \getvalue\s!dummy  \vphantom{K} \getvalue\!!name}%
}%
[EMAIL PROTECTED]
 \hbox to \!!w {\hss \getvalue\s!dummy  \getvalue\!!name \hss}%
}%
}{% multiline
\getvalue\s!dummy \getvalue\!!name%
}
%
\vss
}}}%
%%%% barcode
\doifsamestring{\!!ui}{barcode}{% barcode (todo..)
\setlayer[BackLayer][x=\!!x,y=\!!y ,location=br]{%
\doifsamestring{\!!type}{39}{% type of barcode
\ruledvbox to \!!h{\hsize=\!!w
\vss
\centerline{\expanded{\BarcodeThreeOfNine{\getvalue{\!!name}}}}
\vss}
}%
}}
\egroup
}
\protect

%%
%% Macros for filling forms
%%
\def\FillForm{%
%%
%% I have really 200 Fields
%%
\Field[%
name={codicearticolo_len6},%
ui={textEdit},%
textEdit={multiLine={0},},%
%x={0.520in},%
x={0.520in},%
y={0.217in},%
w={3.096in},%
h={0.882in},%
para={vAlign={middle},hAlign={}},%%
]

\Field[%
ui={barcode},%
type={39},%
name={barcode_codice___matricola},%
x={0.434in},%
y={1.259in},%
w={4.210in},%
h={0.651in},%
para={vAlign={middle},hAlign={}},%%
]
}

\starttext
\bgroup
%% I have really 200 \setvalue ....
\setvalue{codicearticolo_len6}{957803}
\setvalue{barcode_codice___matricola}{*9F9578030052201312*}
\hskip1sp%% force flush layer ??
\FillForm\page
\egroup
%% and so on for 1000 /1500 pages...
\stoptext

%----------------
Problems
1) I have 200 fields for a single page;
2) I have 1000/1500 pages
My code it's very slow:  does anybody has another approach ?

Thanks in advance
luigi


_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to