Shadows are Ignored on Shapes

Hi,
The Shadows, which are configured on shapes, are ignored and not generated in pdf.
Proben-Prozessablauf.vsdx.zip (2.8 MB)
Proben-Prozessablauf.vsdx2.zip (1.9 MB)

see the process shapes on tab “Prozess 1”, “Prozess 2” or “Prozess 3” in the attached visio

thx, stefan

@s.schnud,

We managed to replicate the problem of the missing shadow of the shapes in our environment. It has been logged under the ticket ID DIAGRAMNET-51422 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

1 Like

@s.schnud,

The linked ticket ID DIAGRAMNET-51422 has been resolved and will be included in the next version 18.1 of Aspose.Diagram for .NET API. We will notify you once the next version is published.

@s.schnud,

The linked ticket ID DIAGRAMNET-51422 has been fixed. Please download and try the latest version 18.1 of Aspose.Diagram for .NET API.

I think with the shadows there was another issue introduced. when i replace now a token in my visio with an image, then that shape also has the shadow appliedDateien.zip (1.6 MB)

(the %%Logo%% at the upper left)

Source we are using for replacing:
var document = new Diagram(sourceFilePath);

		foreach (Page page in document.Pages)
		{
			List<Shape> shapes = page.Shapes.Cast<Shape>().ToList();
			foreach (Shape shape in shapes)
			{
				foreach (KeyValuePair<string, string> token in tokens)
				{
					ApplyShapeAction(shape, token.Key, token.Value, ReplaceTextToken);
				}

				if (isReplaceLogo)
				{
					ApplyShapeAction(shape, logoToken, logoPath, ReplaceImageToken);
				}
			}
		}

		document.Save(destinationFilePath, SaveFileFormat.VSDX);
	private static void ReplaceImageToken(Shape shape, string key, string imagePath)
	{
		ReplaceTextToken(shape, key, string.Empty);

		double xPosition = shape.XForm.PinX.Value;
		double yPosition = shape.XForm.PinY.Value;
		double width = shape.XForm.Width.Value;
		double height = shape.XForm.Height.Value;
		double ratioShape = width / height;

		double imageWidth;
		double imageHeight;

		using (var image = Image.FromFile(imagePath))
		{
			imageWidth = image.Width;
			imageHeight = image.Height;
		}

		double ratioImage = imageWidth / imageHeight;

		if (ratioShape > ratioImage)
		{
			width = imageWidth * height / imageHeight;
		}
		else
		{
			height = imageHeight * width / imageWidth;
		}

		using (var imageFileStream = new FileStream(imagePath, FileMode.OpenOrCreate))
		{
			long shapeId = shape.Page.AddShape(xPosition, yPosition, width, height, imageFileStream);

			var imageShape = shape.Page.Shapes.GetShape(shapeId);
			imageShape.XForm.LocPinX.Value = shape.XForm.LocPinX.Value;
			imageShape.XForm.LocPinY.Value = shape.XForm.LocPinY.Value;
			imageShape.Line.LinePattern = new IntValue(0, MeasureConst.Undefined);
		}
	}

@s.schnud,

We are working over your query and will get back to you soon.

@s.schnud,

Kindly send the complete run able code because the code of ReplaceTextToken method is missing as well as token values are not defined. Your response is awaited.

you can skip that, this is a different functionality wich is note required to reproduce the issue

as all our shapes have now the shadow which was introduced in this fix, i think it is reproducable without this specific code to run?

	private static void ReplaceTextToken(Shape shape, string key, string value)
	{
		foreach (FormatTxt formatText in shape.Text.Value)
		{
			var text = formatText as Txt;
			if (text != null && text.Text.Contains(key)) text.Text = text.Text.Replace(key, value);
		}
	}
		return new Dictionary<string, string>
		{
			{ "%%RevNr%%", "ReplacedRev" },
			{ "%%Ersteller%%", "ReplacedErsteller" },
			{ "%%erstellt%%", DateTime.Now.ToString(CultureInfo.InvariantCulture) },
			{ "%%Prüfer%%", "ReplacedPrüfer" },
			{ "%%geprüft%%", "ReplacedGeprüft" },
			{ "%%Freigeber%%", "ReplacedFreigeber" },
			{ "%%freigegeben%%", "ReplacedFreigegeben" },
			{ "%%Status%%", "ReplacedStatus" },
			{ "%%Unternehmen%%", "ReplacedUnternehmen" },
			{ "%%AGB%%", "ReplacedAGB" },
			{ "%%Änderung%%", "ReplacedÄnderungen" },
		};

but anyway, as said, this is not the code which is relevant for the issue.

@s.schnud,

The code of ApplyShapeAction method is not available. Kindly create a small project application and make sure that the problem is reproducible in your environment, and then send us the ZIP of this project. We will investigate your scenario and share our findings with you. Please also highlight the problematic area with a snapshot.