Author |
Topic |
|
Fábio Nascimento
Brazil
72 Posts |
Posted - Jul 26 2023 : 20:37:03
|
Hi
I use ImageEn_CNM.Proc.TextOut to place a "stamp" on multipage TIFF's with "Align_Text_Right".
I ran a script that placed the text over 70.000 mutipage files and they were all placed ate the same place. I used this code:
ImageEn_CNM.Proc.TextOut(Align_Text_Right,5,'CNM nº ' + CNM,'Arial',28,clBlack,fsBold,fsUnderline]);
descricao_ficha := ' [FICHA ' + completar_com(IntToStr(numero_ficha),'0',3) + '-VERSO]'; ImageEn_CNM.Proc.TextOut(Align_Text_Right,48,descricao_ficha,'Courier New',20,clBlack,fsBold]);
But some files are updated everyday, and today the stamp started to be placed a little more to the left causing the text to overlay each other.
I wonder how can I resolve that, I tought using Align_Text_Right should place the stamp on the exact same spot everytime, so they dont overlay.
I tried to make the text have a white "background", so if they overlay, at least the last one would be readable, but I couldnt find a way to do that, the text is always stamped with a transparent backgorund.
I'm attacking some prints to demonstrate!
Thanks!
|
|
xequte
38514 Posts |
Posted - Jul 26 2023 : 23:26:00
|
Hi Fabio
Align_Text_Right will always place the text on the right of the image, however its actual draw position is calculated by the width of the text. If the text and font is the same then you would expect the position to also always be the same, so the question is why Windows (GDI+) is returning a different width for the text. I can't think why this could be, other than some Windows update that affects font handling??
At any rate, more importantly, you should avoid drawing text where there is already text present. Touch the document in some way so that you know whether text already exists (e.g. by setting a TIFF metavalue such as TIFF_DocumentName or TIFF_ImageDescription).
If you must redraw the text, then draw a white background behind, e.g. using the new TextOutEx method:
http://www.imageen.com/help/TImageEnProc.TextOutEx.html
Or in the upcoming 12.2.0 you can get the draw rect from TImageEnProc.TextOut to easily draw a background color
Nigel Xequte Software www.imageen.com
|
|
|
Fábio Nascimento
Brazil
72 Posts |
Posted - Jul 27 2023 : 05:46:47
|
Hi xequte
I bought the License Extension, I'll wait untill I have it working to continue, because the 6.3 version does not have the TextOutEx function!
You said I can check the document to see if there's text at a defined area, do you have any sample code for that matter?
Thanks |
|
|
xequte
38514 Posts |
Posted - Jul 27 2023 : 21:16:44
|
Hi Fabio
TextOutEx() in 12.0.0 already supports background area drawing. Support for getting the defined area of TextOut() requires the latest beta. If you want that version email me for the source code.
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|
|
|