Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
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: