I'm trying to write a watermark over the top of a PDF page. The idea is to draw in a large font, at an angle, but only draw the outline of the characters.
I establish the rotation using the following code, where "h" is the height of the canvas:
SetGraphicsMode(Canvas.Handle, GM_ADVANCED);
angle := -52.3 * pi / 180;
x0 := 0;
y0 := h;
xForm.eM11 := cos(angle);
xForm.eM12 := sin(angle);
xForm.eM21 := -sin(angle);
xForm.eM22 := cos(angle);
xForm.eDx := x0 - cos(angle)*x0 + sin(angle)*y0;;
xForm.eDy := y0 - cos(angle)*y0 - sin(angle)*x0;
SetWorldTransform(Canvas.Handle, xForm);
I then write the text using the following code:
OldBkMode := SetBkMode(Canvas.Handle, TRANSPARENT);
BeginPath(Canvas.Handle);
Canvas.TextOut(X, Y, Text);
EndPath(Canvas.Handle);
StrokePath(Canvas.Handle); // was StrokeAndFillPath
SetBkMode(Canvas.Handle, OldBkMode);
This approach works fine when tested with a TImage.Canvas, but fails when using the pdf.Canvas, because the hollow character outlines are always filled in in the PDF.
Any thoughts?
Thank you!