我有一个封面,我有一张图片填满了大部分页面。
在那张照片上我放了另一张动态的照片,但在这两张照片上我需要再放一张小徽标图片,那就是它出错的地方(徽标图片最后是第二层图片的右下角)
第一层图片
var myImage = section.AddImage(Server.MapPath("~/Content/Images/Forside.png"));
myImage.Height = "23cm";
myImage.Width = "21cm";
myImage.RelativeVertical = RelativeVertical.Page;
myImage.RelativeHorizontal = RelativeHorizontal.Page;
myImage.WrapFormat.Style = WrapStyle.Through;
第二层图片
MigraDoc.DocumentObjectModel.Shapes.Image image1 = section.AddImage(@model.UrlImage);
image1.Width = "15.5cm";
image1.Height = "8cm";
image1.RelativeHorizontal = RelativeHorizontal.Character;
image1.RelativeVertical = RelativeVertical.Line;
image1.Left = Unit.FromCentimeter(0.2);
image1.Top = Unit.FromCentimeter(8.6);
第三层图片
var image4 = section.AddImage(Server.MapPath("~/Content/Images/sun icon.png"));
image4.RelativeHorizontal = RelativeHorizontal.Character;
image4.RelativeVertical = RelativeVertical.Line;
image4.WrapFormat.DistanceLeft = Unit.FromCentimeter(0.2);
image4.WrapFormat.DistanceTop = Unit.FromCentimeter(6.6);
image4.WrapFormat.Style = WrapStyle.Through;
有什么想法吗?
答案 0 :(得分:1)
也将此代码用于第3层:
myImage.RelativeVertical = RelativeVertical.Page;
myImage.RelativeHorizontal = RelativeHorizontal.Page;
计算应该有效的第3层图片的绝对位置。