Currently using WPTools 5.x and wPDF 2.x.
I have the following code to generate watermark when printing to printer from wptools 5.x:
Code
if (wppOutputToPrinter in PaintMode) OR (wppInPaintForwPDF in PaintMode) then begin if (NOT dmContract.DoPrintAsExecuted) then begin imgWidth := imgNotLegal.Picture.Bitmap.Width; imgHeight := imgNotLegal.Picture.Bitmap.Height; toCanvas.StretchDraw(Rect((PageRect.Left + Round(PageRect.Right * 0.20)), (PageRect.Top + Round(PageRect.Bottom * 0.35)), (PageRect.Right - Round(PageRect.Right * 0.20)), (PageRect.Bottom - Round(PageRect.Bottom * 0.35))), imgNOTLegal.Picture.Bitmap); end; end;
And here is the code for the printing to pdf:
Code
while i < aWPRichText.CountPages do
begin
w := MulDiv(aWPRichText.Memo._PaintPages[i].WidthTw,WPScreenPixelsPerInch,1440);
h := MulDiv(aWPRichText.Memo._PaintPages[i].HeightTw,WPScreenPixelsPerInch,1440);
if (w=0) or (h=0) then
begin
w := Round(aWPRichText.Memo.PaintPageWidth[i] / aWPRichText.Memo.CurrentZooming );
h := Round(aWPRichText.Memo.PaintPageHeight[i] / aWPRichText.Memo.CurrentZooming );
end;
xres := aWPRichText.Memo.RTFData.RTFProps.FFontXPixelsPerInch;
yres := aWPRichText.Memo.RTFData.RTFProps.FFontYPixelsPerInch;
StartPage(MulDiv(w, xres, WPScreenPixelsPerInch),
MulDiv(h, yres, WPScreenPixelsPerInch),
xres, yres, 0);
try
// Use 0 as w and h to let the function calculate the width and height
aWPRichText.Memo.PaintRTFPage(i,0,0,0,0,Canvas, [wppInPaintForwPDF] );
finally
EndPage;
end;
inc(i);
end;
Alles anzeigen
Not sure what is wrong here.
Thanks,
Greg