Page 1 of 1
Using DXFImportNET in ASP.NET
Posted: 30 Nov 2005, 10:07
by txia007
Dim FCADImage As CADImage
FCADImage = New CADImage
FCADImage.Load("D:\Inetpub\wwwroot\DXF\RW030.dxf") FCADImage.SaveToFile("D:\Inetpub\wwwroot\JPG\foo.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)
All i want to do is load the dxf file to the CADImage object, and convert it to JPG; However, when i do it in the ASP.NET there is an error message saying "invalid parameters", can someone explain a bit?
Posted: 01 Dec 2005, 18:46
by support
Hello,
Before saving image to the file it is necessary to call CADImage.Draw
The following code demonstrates how it can be done:
Code: Select all
FCADImage.LoadFromFile(@"D:\1.dxf");
Bitmap b1 = new Bitmap(500, 500);
FCADImage.Draw(Graphics.FromImage(b1), new RectangleF(0, 0, b1.Width, b1.Height));
FCADImage.SaveToFile(@"D:\1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Sergey.
please post questions to the forum or write to
support@cadsofttools.com
Posted: 31 Dec 2005, 22:17
by fchateau
> FCADImage.SaveToFile(@"D:\1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
For anyone interested, in ASP.NET you usually are not trying to save a file locally. Most of the time the idea is to prepare the image for downloading. The link below contains example code in C# on how to do that from a .NET ASHX handler.
http://68.52.68.77/homepage/sampletwo.htm
Regards,
Fred Chateau
Posted: 05 Jan 2006, 12:32
by support
Hello,
If they don't use absolute paths it is possible to go by the following way:
Code: Select all
FCADImage.SaveToFile(@"http://localhost/MyDir/1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Nevertheless you can get absolute path using 'Server.MapPath'.
Sergey.
please post questions to the forum or write to
support@cadsofttools.com