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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEvolution RenderToGraphics

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
u.bruegelmann Posted - Mar 15 2012 : 06:00:26
Hi there,
I'm trying to print selected pages from a multi page tiff and add an overlay to each page.
Basic idea was to use an IEMulti (instace var imIO), PrintDocument.Print and an event handler looking like this:


procedure TTComFaxThread.DoPrintPage(sender:TObject; e : PrintPageEventArgs);
var
f : System.drawing.font;
img : IEImage;
h,w : integer;

begin
f := System.drawing.font.Create('Arial',8,FontStyle.Bold);
img := imIO.ImageList.GetImage(iPageVarFromInstance-1);
h := trunc(e.PageBounds.Height/100*e.Graphics.DPIY);
w := trunc(e.PageBounds.Width /100*e.Graphics.DPIX);
img.RenderToGraphics(e.Graphics,0,0,w,h,0,0,img.Width,img.Height,255,IEResampleFilter.FastLinear,RenderOperation.Normal);
e.Graphics.DrawString('INDIV Nummer: ' + SomeInstanceVar + ' - VPC: 58506',f,brushes.Black,150,80);

e.hasMorePages := SomeInstanceVar;
end;

Problem now is, that DrawString raises an exception with the message (translated from German) "Object already in use"
Any clue as to what I could do to circumvent that?
2   L A T E S T    R E P L I E S    (Newest First)
u.bruegelmann Posted - Mar 15 2012 : 23:13:55
Hi,

thanks a lot. Works fine now.
fab Posted - Mar 15 2012 : 06:18:47
Hi,
this is a bug of current version of IEvolution. Please try following workaround: just after RenderToGraphics() call e.Graphics.ReleaseHdc(). For example:

...
w := trunc(e.PageBounds.Width /100*e.Graphics.DPIX);

img.RenderToGraphics(e.Graphics,0,0,w,h,0,0,img.Width,img.Height,255,IEResampleFilter.FastLinear,RenderOperation.Normal);
e.Graphics.ReleaseHdc();

e.Graphics.DrawString('INDIV Nummer: ' + SomeInstanceVar + ' - VPC: 58506',f,brushes.Black,150,80);
...