ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Cannot create TIECanvas. Ensure GDI+ is installed on system
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

96 Posts

Posted - Jan 12 2022 :  01:26:47  Show Profile  Reply
my code fails randomly with 'Cannot create TIECanvas. Ensure GDI+ is installed on system.' in Multithreading.

var
  IO: TImageEnIO;
  Proce: TImageEnProc;

 IO := TImageEnIO.Create(nil);
  IO.Params.PDF_PaperWidth := 1190;
  IO.Params.PDF_PaperHeight := 842;
  IO.Params.PDF_Compression := ioPDF_JPEG;
  Proce := TImageEnProc.CreateFromBitmap(IO.IEBitmap);

IO.CreatePDFFile(vPDFName);

 if IO.LoadFromStreamJpeg(PhotoStream) then
begin
Proce.TextOut(vPosX, vPosY, vMarkInfo, 'Times New Roman', MarkTextFontSize, clRed, [fsBold]);
IO.IEBitmap.RemoveAlphaChannel();
 IO.SaveToPDF;
 IO.ClosePDFFile;
end;


xequte

38610 Posts

Posted - Jan 12 2022 :  21:09:38  Show Profile  Reply
Hi

It might be a resource access issue. Try using the TCanvas TextOut methods instead.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 12 2022 :  21:31:54  Show Profile  Reply
I used the code below and the result is the same.

IO.IEBitmap.IECanvas.Font.Size := MarkTextFontSize;
IO.IEBitmap.IECanvas.Font.Color := clRed;
IO.IEBitmap.IECanvas.Font.Name := '#23435;#20307;';
IO.IEBitmap.IECanvas.Font.Style := [TFontStyle.fsBold];
IO.IEBitmap.IECanvas.TextOut(vPosX, vPosY, vMarkInfo);
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 12 2022 :  22:02:14  Show Profile  Reply
I just tested it,the larger the number of threads is set, the greater the probability of this error.
Go to Top of Page

xequte

38610 Posts

Posted - Jan 12 2022 :  22:55:36  Show Profile  Reply
Hi

I meant TCanvas, i.e.

IO.IEBitmap.Canvas.Font.Size := MarkTextFontSize;
IO.IEBitmap.Canvas.Font.Color := clRed;
IO.IEBitmap.Canvas.Font.Name := '#23435;#20307;';
IO.IEBitmap.Canvas.Font.Style := [TFontStyle.fsBold];
IO.IEBitmap.Canvas.TextOut(vPosX, vPosY, vMarkInfo);


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 13 2022 :  03:34:11  Show Profile  Reply
Hi,
Thank you. The error doesn't appear anymore, but when writing text, if the text overlaps, the text on the bottom layer will be blocked by the text on the top layer. It was transparent when using the IECanvas.TextOut method before. How can I make the text completely transparent?

for I := 1 to 10 do
begin
IO.IEBitmap.AlphaChannel.Canvas.Font.Size := MarkTextFontSize;
IO.IEBitmap.AlphaChannel.Canvas.Font.Color := clRed;
IO.IEBitmap.AlphaChannel.Canvas.Font.Name := 'Times New Roman';
IO.IEBitmap.AlphaChannel.Canvas.Font.Style := [TFontStyle.fsBold];
IO.IEBitmap.AlphaChannel.Canvas.TextOut(50, 50 + (I * 20), 'This is the ' + I.ToString + ' row.');
end;
IO.IEBitmap.RemoveAlphaChannel(True, clRed);

Go to Top of Page

xequte

38610 Posts

Posted - Jan 13 2022 :  20:32:11  Show Profile  Reply
Hi

You need: Canvas.Brush.Style := bsClear;

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: