Free Support Forum - aspose.com

Adding a watermark

I am using ASPOSE in a Delphi app, through COMInterop. I am having difficulty adding a watermark through COM, as the _Shape constructor does not have the Document and ShapeType parameters and I am unable to set these properties in the _Shape because the properties are read-only.

Is there a solution to this issue? My troublesome Delphi code is below:

Thanks,

Martin

procedure TAsposeServer.AddWatermark(ADoc: _Document; AStr: string);
var
wm: _Shape;
begin
wm := CoShape.Create;
// Above in C#: Shape wm = new Shape(ADoc, ShapeType.TextPlainText);
// Below fails b/c properties are read-only
wm.Document := ADoc; // <—
wm.ShapeType := ShapeType_TextSimple; // <—
// Above fails b/c properties are read-only

wm.TextPath.Text := AStr;
wm.TextPath.FontFamily := ‘Arial’;
wm.Width := 500;
wm.Height := 100;
wm.Rotation := -45;
wm.FillColor := clGray;
wm.StrokeColor := clGray;
wm.RelativeHorizontalPosition := RelativeHorizontalPosition_Page;
wm.RelativeVerticalPosition := RelativeVerticalPosition_Page;
wm.WrapType := WrapType_None;
wm.VerticalAlignment := VerticalAlignment_Center;
wm.HorizontalAlignment := HorizontalAlignment_Center;

Hi Martin,

We are investigating the issue and will update you soon.

Best Regards,

Hi Martin,

Please try wm := CoShape.Create(ADoc, ShapeType_TextSimple);

Best Regards,

Thanks Muhammad.

Unfortunately, there is no CoShape constructor that accepts those parameters. I get a compile error: “Too many actual parameters”.

Hi Martin,

A new issue to support setting Document and ShapeType properties via a public method has been logged into our issue tracking system as WORDSNET-12362. We will let you know as soon as the issue is resolved.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan