It sounds like you’re experiencing issues with the aspect ratio of a shape when using Aspose.Diagram to create Visio files and convert them to PDF. To resolve this, you should set the AspectRatioLocked property to true. This will ensure that the shape’s dimensions are adjusted proportionally when you change either the width or height.
Here’s a code snippet to help you implement this:
// Assuming 'shape' is your shape object
shape.AspectRatioLocked = true;
// Set the desired width and height
if (node["shape"].ToString() == "Start/End")
{
width = desiredWidth;
height = width / 2; // Maintain aspect ratio of 2:1
shape.Width = width;
shape.Height = height;
}
Make sure to apply this setting before saving or converting your diagram to PDF. If the shape still appears distorted, double-check the dimensions you’re setting and ensure that the shape type supports aspect ratio locking.
To proceed, implement the code snippet and test the output. If you continue to face issues, please provide additional details about the shape type or any error messages you encounter. I’m here to help!
@rohithajare
Thanks for the screenshots.
It seems you want to change the connector line from a polyline to a straight line. Please try using the following code to set the properties of this connector line before connect shapes.
If you still experience the same issue, then please provide us a demo console application with the template file that should help us to reproduce the issue on our end.
Hi the issue is with terminator and its bumped shape please suggest a solution regarding same . no issue seen with connector {878B248F-6B94-4C40-B7D6-AFF05C369F75}.png (6.4 KB)
@prathmeshg
Please provide us a demo console application that should help us to reproduce the issue on our end .
Or could you please share the template file and sample code?
Thanks.
@prathmeshg
Thanks for sharing the sample code.
Unfortunately, we’re unable to execute the code successfully as we’re missing the following required file: “Templates/Flowchart/clara_stencil.vssx”.
Please also share the template file “Templates/Flowchart/clara_stencil.vssx” to make the code run successfully.
Thanks.
We called this interface “GenerateFile” in the code, but unfortunately it threw an exception “Invalid data for diagram generation”. After commenting out this code section, we encountered another error: ‘Master with name Hexagon does not exist in the collection of Masters’. There’s no master named “Hexagon” in the file “clara_stencil.vssx”.Upon removing this problematic portion, we finally succeeded in generating the PDF. We couldn’t reproduce the issue you described.
Please check the generated PDF file - could there be an issue with our calling method or other implementation aspects? out.pdf (102.7 KB)
Could you please create a standalone console application (runnable), zip the project and post us?We will evaluate your issue further.
Unfortunately, the code is missing some methods, such as HttpRequestUtility and DynamicTypeParser, so we are unable to run the entire program. It would be better if you could provide these methods or a simple runnable project.
We’ve commented out some code sections, but since the JSON data reading functionality hasn’t been implemented, these modifications should effectively be non-functional.
We also noticed that several masters have been added in your newly shared code that were not present in the original VSSX file.
Please review accordingly.
Thanks. code.zip (6.3 KB)