Hi,
for watermarks dont use StretchDraw - you cannot reuse the image this way.
See watermark demo:
var
i, w, h, image_id: Integer;
conversion_factor : Real;
const
colors: array[1..3] of TColor = (clRed, clLime, clYellow);
// Utility function to use the wPDF JPEG export function directly
function DrawJPEG(xx, yy, ww, hh: Integer; jpeg: TJPEGImage): Integer;
var
temp: TMemoryStream;
begin
temp := TMemoryStream.Create;
Result := -1;
try
jpeg.SaveToStream(temp);
Result := WPPDFPrinter1.DrawJPEG(xx, yy, ww, hh,
jpeg.Width, jpeg.Height,
temp.Memory, temp.Size);
finally
temp.Free;
end;
end;
begin
// WPDF_START(LICNAME, LICKEY);
image_id := -1;
WPPDFPrinter1.BeginDoc;
try
for i := 1 to 3 do
begin
w := Image1.Picture.Graphic.Width;
h := Image1.Picture.Graphic.Height;
WPPDFPrinter1.StartPage(w, h, 72, 72, 0);
conversion_factor := Screen.PixelsPerInch / 72; // ScreenCanvas : PDF Canvas !
// We draw our image, but only one time and clone the other
if image_id < 0 then
begin
if Image1.Picture.Graphic is TJPEGImage then
image_id := DrawJPEG(0, 0, w, h, TJPEGImage(Image1.Picture.Graphic))
else image_id := WPPDFPrinter1.DrawBitmap(0, 0, w, h, Image1.Picture.Bitmap.Handle);
end
else
WPPDFPrinter1.DrawBitmapClone(0, 0, w, h, image_id);
// Now the "watermark"
WPPDFPrinter1.Canvas.Pen.Color := colors[i];
WPPDFPrinter1.Canvas.Pen.Width := 3;
WPPDFPrinter1.Canvas.Ellipse(Round(360*conversion_factor), Round(170*conversion_factor),
Round(410*conversion_factor), Round(220*conversion_factor));
WPPDFPrinter1.EndPage;
end;
finally
WPPDFPrinter1.EndDoc;
end;