Hi,
First I made javascript functions for different needs - here you can see 3 of them:
-------------
var myDocument=app.activeDocument;
function addtextbox(pagenr,x1,y1,x2,y2,tstyle,tcontents) {
with(myDocument){
with(pages.item(pagenr-1)){
tTextFrame=textFrames.add();
tTextFrame.geometricBounds=[y1,x1,y2,x2];
tTextFrame.contents=tcontents;
tTextFrame.texts.item(0).appliedParagraphStyle=tstyle;
}
}
}
function addtextboxwithstroke(pagenr,x1,y1,x2,y2,tstyle,tcontents,tstrokeWeight,tstrokeSwatch) {
with(myDocument){
with(pages.item(pagenr-1)){
tTextFrame=textFrames.add();
tTextFrame.geometricBounds=[y1,x1,y2,x2];
tTextFrame.contents=tcontents;
tTextFrame.strokeWeight=tstrokeWeight;
tTextFrame.cornerEffect=CornerEffects.roundedCorner;
tTextFrame.cornerRadius=0.5;
tTextFrame.strokeColor=swatches.item(tstrokeSwatch);
tTextFrame.texts.item(0).appliedParagraphStyle=tstyle;
}
}
}
function drawrectangle(pagenr,x1,y1,x2,y2,tFillSwatch) {
with(myDocument){
with(pages.item(pagenr-1)){
tRectangle=rectangles.add();
tRectangle.geometricBounds=[y1,x1,y2,x2];
tRectangle.fillColor=swatches.item(tFillSwatch);
tRectangle.strokeWeight=0;
}
}
}
--------------
Now I made php script that took data from my database, calculated the right page numbers and locations and printed out a lot of lines like this:
addtextbox(3,-20,122,-10,130,"style1","My text");
(if you look at function definitions, you'll probably understand what these numbers mean)
Now you can run the php script in your browser, save the result (source) as .js file (with the functions of course) to C:\Program Files\Adobe\Adobe InDesign CS\Presets\Scripts (or whatewer it may be in you system) and the run it from the script window.
Peeter