You are not logged in.
Pages: 1
I'm trying to copy the VCLCanvas to my own bitmap to mimic transparency, but it doesn't copy anything.
What am I doing wrong?
var
Fpdf:TPdfDocumentGDI;
Abmp:TBitmap;
W, H: Integer;
begin
Fpdf:=TPdfDocumentGDI.Create;
Abmp:=TBitmap.Create;
try
W:=250;
H:=150;
Abmp.Width:=W;
Abmp.Height:=H;
Fpdf.DefaultPaperSize:=psA4;
Fpdf.ScreenLogPixels:=Screen.PixelsPerInch;
Fpdf.AddPage;
// Output some text on the canvas
FPdf.VCLCanvas.TextOut(10,10,'Demo text');
// Copy the VCLCanvas into the BMP canvas
Abmp.Canvas.CopyRect(Rect(0,0,W,H),Fpdf.VCLCanvas,Rect(0,0,W,H));
// add some other text tot the bitmap canvas
Abmp.Canvas.TextOut(15,15,'Another text');
// copy the bitmap canvas back onto the vclcanvas
Fpdf.VCLCanvas.StretchDraw(Rect(200,200,200+W,200+H),Abmp);
Fpdf.SaveToFile('d:\test.pdf');
finally
Abmp.Free;
Fpdf.Free;
end;
end;
Pages: 1