Printing fields with images included by « set the imageSource of such char »

André.Bisseret Andre.Bisseret at inria.fr
Thu Mar 16 07:33:11 EST 2006


Hi !
On each card of an App. I have differents texts ; some are including 
images that are put there by means of one char on a line (ex. : £,§,€…) 
whose imageSource is set to an image number (the images are in a 
special substack).
I want the user be able to print the text of this fld.

My first method is the following :
I created a hidden field (in the main stack), say field « toPrint » in 
which I am composing (from several fields in a card) and formating the 
text to print.
The core of it is :
put fld « theText » into fld « toPrint »
set the HTMLText of fld « toPrint » to the HTMLText of fld «theText ».

Then I print with
revShowPrintDialog false,true
put tab & "Page " & "<%pageNumber%>"  into footer
   revPrintText (the htmlText of fld "toPrint"),,footer

That works very well on Mac, The field « toPrint » is printed exactly 
as I want, including printing the images nicely.

But testers got problems with Windows (mainly, repetitions of part of 
the text on new pages).

So I am trying another method using a special PrintingStack with two 
fields, one, say, the « bufferField » the other the fldToPrint : 
filling in the second while emptying the first, line after line (thanks 
to the explanations I founded in the SmartEBook on Printing by Dan 
Schafer).

.Mainly :
repeat until the formattedHeight of fld "fldToPrint" of cd cardNum >= 
gPrintHeight
     set the htmlText of line lineToAdd of fld "fldToPrint"\
     to the htmlText of line 1 of fld "bufferField" of cd 1
     delete line 1 of fld "bufferField" of cd 1

All works well if there is no image.

When there is an image, the image appears normally.
BUT  it is followed by an incredible mess (a lot of chars such as 
squares, apples, and so on) which could take several pages if it was 
not  remaining on the same card where the image appears.
Then the normal text is following, normally on another created card.

Is it possible to manage to avoid such a mess ?
Thanks a lot in advance for any suggestion

Best regards from Grenoble
André





More information about the Use-livecode mailing list