We are testing the SVG converter to convert a simple SVG to PNG image using:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="3200" height="3200" viewBox="0 0 400 400" xml:space="preserve">
<desc>Created with Fabric.js 3.2.0</desc>
<defs> </defs>
<g clip-path="url(#CLIPPATH_3)" >
<g transform="matrix(0.03050595 0 0 0.03050595 200 191.5)" >
<clipPath id="CLIPPATH_3" >
<rect transform="matrix(1 0 0 1 200.5 192)" x="-80" y="-61.5" rx="0" ry="0" width="160" height="123" /> </clipPath>
<image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="[d12b6c30-0996-47dc-8642-338c6e12613f.jpg](view-source:file:///C:/Users/workstation/Desktop/d12b6c30-0996-47dc-8642-338c6e12613f.jpg)" x="-1512" y="-2016" width="3024" height="4032"></image>
</g>
</g>
</svg>
The odd thing is if i open the svg in firefox before rendering as an image the image is correct in being vertical. If i open the svg in internet explorer it displays horizontal even though the width is shorter that the height
correct view
aposeCorrect.JPG (28.0 KB)
incorrect way
aposeInCorrect.JPG (78.8 KB)
Now as we do this programmatically via .net api in c# we get the internet explorer view of the convertion. Ive tried to change default programs but not helping with the issue. I am unable the alter the svg files before hand as this is how we get them.
Any assistance would be greatly appreciated.
c# code:
using (var document = new SVGDocument(@“C:\Users\workstation\Desktop\5705925c-9650-32d2-5eb6-e9ba8e73f0e1.svg”))
{
var pngSaveOptions = new ImageSaveOptions(Aspose.Svg.Rendering.Image.ImageFormat.Png);
pngSaveOptions.PageSetup.AnyPage = new Aspose.Svg.Drawing.Page(new Aspose.Svg.Drawing.Size(3200, 3200), new Aspose.Svg.Drawing.Margin(0, 0, 0, 0));
pngSaveOptions.PageSetup.Sizing = Aspose.Svg.Rendering.SizingType.FitContent;
pngSaveOptions.SmoothingMode = SmoothingMode.AntiAlias;
pngSaveOptions.Text.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
pngSaveOptions.BackgroundColor = System.Drawing.Color.Transparent;
Converter.ConvertSVG(document, pngSaveOptions, Path.Combine(@"C:\Users\workstation\Desktop\", "result.png"));
}
Ive tried altering this code and the sizingtypes but all producing the same problem. Its like its viewing it as if in IE before rendering.
@lozgarbett
Can you please share the SVG file with its resources in a .zip format? We copied and pasted the SVG content into new file but could not get the correct image to test with in our environment.
Please see attached zip with Image and svg file. I have also just recreated the same dimensions image file too and saved as the same file name and for some reason this one appears to display correctly?! Really confusing me:
5705925c-9650-32d2-5eb6-e9ba8e73f0e1.zip (3.4 MB)
Test with recreated image file:
5705925c-9650-32d2-5eb6-e9ba8e73f0e1 (2).zip (28.1 KB)
Please see new post with the information.
@lozgarbett
We tried to convert both of your SVG files using Aspose.SVG for .NET 21.8 and did not notice any issues. For your kind reference, we have attached output files for both SVGs.
output_02.png (59.2 KB)
output_02.png (59.2 KB)
Could you please make sure to use the latest version of the API and please share the problematic SVG file in case you still notice any issues.
Hi,
5705925c-9650-32d2-5eb6-e9ba8e73f0e1.zip (3.4 MB)
Using the above zip file and Aspose.net SVG version 21.8 i get the result below which is rotated when it shouldn’t
result_1.jpg (343.3 KB)
Just incase it makes a difference im using .net 4.5.2 Visual Studio 2015.
But our production server gives the same result as above. Server 2016.
@lozgarbett
We were able to replicate the similar issue in our environment. Hence, have logged it as SVG-150 in our issue tracking system for the sake of correction. We will further investigate it and let you know as soon as it is rectified. Please be patient and spare us some time.
We are sorry for the inconvenience.
Can i add an additional Bug here also please regarding text management and spaces. The API seems to be ignoring spaces put in a svg file with regards to text on another line will attach the files:
Correct way is suppose to be:
This is the first line
… …2nd line
But Aspose.SVG API is converting to png as:
This is the first line
2nd line
2d462418-bd17-43e2-b536-494cc95fac65.zip (81.9 KB)
The text is white so difficult to see but result is:
CaptureAspose.JPG (71.4 KB)
Even the forum is removing the spaces that i used to center the 2nd line lol. Will edit and use … instead
@lozgarbett
We have logged another issue as SVGNET-30 in our issue tracking system. We will further check it in details and keep you posted with its rectification status. Please be patient and spare us some time.
We are sorry for the inconvenience.
Not going to well this. I have another bug to be added please. Image issue again image is scaling to over text area unlike in the svg file. Here is the svg files:
c4d15808-0f4e-4a1b-8be2-22b148c912b8.zip (399.6 KB)
Here is the result with image over text:
10781150^1000180285^66099279113795^CUS_61372-47^_1.jpg (485.5 KB)
@lozgarbett
Another issue as SVGNET-31 has been logged in our issue management system for the sake of rectification. We will surely let you know as soon as it is resolved.
We apologize for the inconvenience.